# Solved: Start Time End Time Difference in Microsoft Access 2000

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

#### ka23fabulous

Hi! I have put a "Total Time" field in a form to calculate the difference in minutes from the "Start Time" to the "End Time". I was worried about getting the incorrect time span when the time crossed over midnight. Well, I got that part right, but when I enter times in the same day (1:15pm-1:30pm) it gives me the time difference PLUS 1440 minutes. Please tell me what I need to do to fix this! Thank you!

Total Time:
=DateDiff("n",[Date]-IIf(1-[Start Time]>[End Time],0,1)+[Start Time],[Date]+IIf(1-[Start Time]>[End Time],1,0)+[End Time])

#### slurpee55

Assuming the dates are sequential, this would work for those over midnight items.
EXPR1: (IIf([End Time]<[Start Time],[End Time]-[Start Time]+24,[End Time]-[Start Time]))

You could also just add a previous date difference expression and use it in the formula in place of the simple "24" - if the difference in days was called [Days apart] then that value would be [Days apart]*24

#### ka23fabulous

Ok, I put in the expression and it is giving me a number of .00138888888889 for a time difference that should be 2 minutes

#### slurpee55

you need to format the expression field as Short Time

here you go

#### Attachments

• 12.9 KB Views: 317

#### nesr

Ok, I put in the expression and it is giving me a number of .00138888888889 for a time difference that should be 2 minutes
That's right
Just multiply the result*24*60
The formula would be
EXPR1: (IIf([End Time]<[Start Time],[End Time]-[Start Time]+24,[End Time]-[Start Time]))*1440

the result will be 2.0
SOLVED

#### ka23fabulous

Thank you!! I am working on a database that is a little more involved than ones I usually work on, so I will probably be posting again. Thanks for your help!!

#### nesr

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

As Seen On