Time calculations using 24 hr clock

  • Thread starter Thread starter RVP
  • Start date Start date
R

RVP

Guest
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
 
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
 
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
 

Users who are viewing this thread

Back
Top Bottom