Shifts over two days

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am creating a database to work out running times of machines. When shifts run past midnight I am having trouble getting access to calculate the time correctly.

If a time goes 22:00 to 01:00 the only data recorded is the starting date (ie 22:00). How can I calculate the difference between the two when the 22:00 is one day and the 01:00 is another but only 1 date is reorded

Cheers
 
Best solution might be to record the date and time (rather than just the
time).

If that's not practical, you could add a day to the end time if it is less
than the start time. The calculated field in your query would be something
like this:

Minutes: DateDiff("n", [StartTime], IIf([EndTime] < [StartTime]), [EndTime]
+ 1, [EndTime]))

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

L. Khaiki said:
I am creating a database to work out running times of machines. When
shifts run past midnight I am having trouble getting access to calculate the
time correctly.
If a time goes 22:00 to 01:00 the only data recorded is the starting date
(ie 22:00). How can I calculate the difference between the two when the
22:00 is one day and the 01:00 is another but only 1 date is reorded.
 
Back
Top