Date Time Difference

Mike Hughes

Registered User.
Local time
Today, 12:14
Joined
Mar 23, 2002
Messages
493
I'm trying to figure the difference in time between the START and END fields
Both the fields are DATE/TIME fields. All the differences will be in minutes and seconds, the date will always be the same. Attached is a shot of the table.

SELECT
[TABLE 5].USERID,
[TABLE 5].CASE,
[TABLE 5].SCREEN,
[TABLE 5].START,
[TABLE 5].END,
FROM [TABLE 5];
 

Attachments

  • DateTime.jpg
    DateTime.jpg
    20 KB · Views: 97
I'm trying to figure the difference in time between the START and END fields
Both the fields are DATE/TIME fields. All the differences will be in minutes and seconds, the date will always be the same. Attached is a shot of the table.

SELECT
[TABLE 5].USERID,
[TABLE 5].CASE,
[TABLE 5].SCREEN,
[TABLE 5].START,
[TABLE 5].END,
FROM [TABLE 5];

DateDiff("s", StartTIme, EndTime) will get you the Number of seconds between two times (Minutes="n", hours="h"). Of course, you will need to format the results according to your needs.
 
if you do a DateDiff() to get the number of minutes between the two points then use the following function

Code:
Function MinsToTime(Mins As Integer) As String
    MinsToTime = Mins \ 60 & " hour" & IIf(Mins \ 60 <> 1, "s ", " ") & Mins Mod 60 & " minute" & IIf(Mins Mod 60 <> 1, "s", "")
End Function

This will give you the difference in n hours n minutes
Example:

Code:
Elapsed = MinsToTime(CInt(DateDiff("n",Start,End))

Returns

1 hour 33 minutes where start = 12:57 and End = 14:00
 
I used the first example and that worked good for me. thanks for your help
 
Ok, Ok it was late and I was not functioning correctly
 

Users who are viewing this thread

Back
Top Bottom