Results between times

  • Thread starter Thread starter noble-con
  • Start date Start date
N

noble-con

Who knows the solution how to get the result between two times, in access 2007.

For example:

The job started at 10:00 field 1
The job ended at 13:11 field 2
Result 3:11 field3
The total time should be able to exceeded 24:00 hours.

A waiting suggestions.

Hendrik Edel
 
Use the DateDiff function to get the difference in minutesand then use the
result to construct a string with the desired output

X = DateDiff("n",Field1, Field2)
X Mod 60 will return the number of minutes
X \ 60 will return the number of hours

Putting that altogether in one statement you would get:
DateDiff("n",Field1, Field2) \ 60 & ":" & Format(DateDiff("n",Field1,
Field2) Mod 60,"00")

Although for efficiency I would probably store the DateDiff calculation in a
variable and then do
X \ 60 & ":" & Format( X Mod 60,"00")

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"(e-mail address removed)"
 
Back
Top