View Full Version : Time calculations using 24 hr clock


RVP
01-29-2001, 12:16 AM
I have written a query which calculates the time interval between two times (24 hr clock format)using DateDiff("h",time1, time2). The query works OK but whenever the "time1" is before 00:00 (midnight) and "time2" is after midnight, I get a negative value eg if "time1" is 23:30 and "time2" is 03:30, the result is a negative value. How can I get the correct answer?
Thanks

Neo90815
01-29-2001, 03:54 PM
I don't know if this would help you or not but I use this to calculate the time diff. It returns hr:min; Start Time 4:44 pm end time 1:00am, it will return 15:44.

**************************************
Format([StarTime]-1-[EndTime],"Short Time")
**************************************

Hope this help!

Neo

FionaC
12-12-2001, 08:44 PM
Try this formula - it works if there is not more than 24 hrs difference

=(IIf(([finish time]+1)<([Start time]+1),(([finish time]+1)+1),([finish time]+1))-(([Start time])+1))

Multipy by 24 if you want decimaal equivelent time