Hours Calculated incorrectly with DateDiff

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

Guest

I am using the DateDiff in the following function, PreHours:
DateDiff("h";[Shift Assignment Table]![Time In];[Shift Assignment
Table]![Time Out]), but both Time In and Time Out include hours and minutes.
However, I have noticed that some of my hours are incorrect. Could someone
kindly tell me what I am doing wrong? Thank you!
 
DateDiff() only looks at the hours, so it believes there is a 2 hour
difference between 9:59am and 11:00am (i.e. 11 - 9 = 2.)

To get a more accurate value, calculate the difference in minutes and (if
you wish) round to the nearest hour, e.g.:
Round(DateDiff("n";[Shift Assignment Table]![Time In];[Shift Assignment
Table]![Time Out]) / 60, 0)
 
Back
Top