Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculating time over midnight

Status
Not open for further replies.

jonney

Instructor
Jun 17, 2003
35
GB
I have 2 text boxes formatted as Date/Time - Short time. The user puts in a start time and a finish time. Using =((([FinishTime]-[StartTime])*14.4)*100)/60 this calculation I can work out the duration between the 2 time input. However if the Start Time is before Midnight and the finish time is after midnight this does not work. Anybody got any ideas??

Cheers
 
I think you need:

=iif([FinishTime]>=[StartTime,([FinishTime]-[StartTime])*1440/60, ([FinishTime]+1-[StartTime])*1440/60)

This assumes no-one can work for more than 24 hours non-stop.
 
Hi

why not look at DateDiff() in help, depite its name it will return the difference between two times

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top