Click to See Complete Forum and Search --> : help!


October 28th, 1999, 09:11 AM
Dear all,

Many thanks for the recent posts on calculating time differences, but im still having problems with this.

I have two fields inside a recordset which are type text, they have captured the time using the 'time' function. The field therefore looks something like this 3:09:31 PM.

The fields are used for capturing login and logout times.
First field 3:09:31 PM
Second 3:15:16 PM

Now i don't need to work out date differences, only times. But i obviously want to return something like 6 mins so many seconds, instead of xxxx seconds. Can someone pls point me in the right direction.

Many thanks for all your help.

Aaron Young
October 28th, 1999, 01:58 PM
You coudl use the CDate Function to convert the Strings to Date/Time Variables, then Subtract One from the Other, eg.

private Sub Command1_Click()
Dim sTimeDiff as string
sTimeDiff = Format(CDate("3:15:16 PM") - CDate("3:09:31 PM"), "NN:SS")
End Sub



In this case sTimeDiff Would Contain "05:45", (5 Mins, 45 Secs).

Aaron Young
Analyst Programmer
adyoung@win.bright.net
aarony@redwingsoftware.com