Time duration

T

teyterry

With Access 2002, how do you calculate the time
difference into hr:min or just minutes? For example,
from Dec 21st 2002, 0200h till Dec 21st 2002, 0315h. And
between Jan 2nd 2004 2300h till Jan 3rd 2004 0110h.

Thank you.
 
K

Ken Snell

To get the minutes of the duration, use the DateDiff function:

MinutesElapsed = DateDiff("n", StartDateTime, EndDateTime)

You can divide this result by 60 to get hours and fractions of hours.

To get the display as hh:nn (hours:minutes):

DisplayResult = Format(DateDiff("n", StartDateTime, EndDateTime) \ 60, "0:")
& _
Format(DateDiff("n", StartDateTime, EndDateTime) Mod 60, "00")
 

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

Top