Hours Calculated incorrectly with DateDiff



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!

Allen Browne

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)

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads