Full Version: Calculate Hours between two dates
UtterAccess Discussion Forums > Microsoft® Access > Access Date + Time
jmorrow76
I am working on a punch in punch out feature for a projects db I am working on & I can not figure out how to calculate the hours between the check out date & check in dates. Any ideas or snippets?
R. Hicks
Use the DateDiff() function to return the elasped time ...

RDH
AJS
Try the DateDiff function, assuming your check in and check out dates are actual date/time values.

DateDiff("h", CheckIn, CheckOut)

-AJ
jmorrow76
That works perfect! One more quickie, how do I get it to be a positive num instead of a negetive?
R. Hicks
You need to reverse your date values in the function arguments ...

The start date/time is should be first .. then the end date/time ..

RDH
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.