Calculations using hours

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have employee time ticket entries that include "start time" and "end time".
I need to calculate the total number of hours for each entry, but when I
subtract 'start time' from 'end time' I'm not getting a correct
answer....i.e.: 16:00 - 13:00 is coming up as 0.13???

Pls help.
Thank you
 
Hi,


0.13 is 0.13 of a day. In your case, it is probably 0.125 in fact.

If the total is less than 24 hour, format( myTotal, "hh:nn:ss")


It the total is more than 24 hour, can try: INT( myTotal) & "+" &
format( myTotal, "hh:nn:ss" )


There is a problem if you are too close to midnight:

? int( 0.99999) & "+" & format( 0.99999, "hh:nn:ss")
0+23:59:59

BUT, adding 9 / 1 000 000 of a day:

? int( 0.999999) & "+" & format( 0.999999, "hh:nn:ss")
0+00:00:00


is wrong, it should be 1+00:00:00. If you don't play with tenth of a
second, you should be fine.




Hoping it may help,
Vanderghast, Access MVP
 
Dear Neen:

Well, 16:00 - 13:00 is 3 hours, or 1/8 of a day, which is .125. .13
is just this value rounded to two places. So, if you multiply by 24,
it should give you hours, with a decimal fraction for any fraction of
an hour.

The approved way would be to use DateDiff with the option for the
interval you wish to see. This is in online help.

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 
Thank you for the help. Will try this.

Tom Ellison said:
Dear Neen:

Well, 16:00 - 13:00 is 3 hours, or 1/8 of a day, which is .125. .13
is just this value rounded to two places. So, if you multiply by 24,
it should give you hours, with a decimal fraction for any fraction of
an hour.

The approved way would be to use DateDiff with the option for the
interval you wish to see. This is in online help.

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 
Back
Top