Time duration calculation needed

G

Guest

I have added a columns to my database table to capture event start and end
date (as a short date) and times (as short time). In my query I need to
calculate the time duration between the start and end of the timed event. The
claculation is as follows Downtime Duration: [End Time]-[Start Time]. For
example, event starts at 1430 and ends at 1530. The duration should be 1 hour
or 60 minutes. My calculation is not delivering the correct values. Anyone
have a solution?
 
K

Ken Snell [MVP]

Check out the DateDiff function -- it's designed to handle such
calculations.

Your direct subtraction would work (giving you elapsed time in hours) if you
changed it to this:
Downtime Duration: ([End Time]-[Start Time]) * 24

This is because ACCESS stores date and time as a double-precision number,
where the integer portion (date) is the number of days since December 30,
1899 (midnight) and the decimal portion (time) is the fraction of a 24-hour
day represented by the time.
 

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