Calculate number of hours?

H

Henro

I have a lot of hours added up. Now I want to show the total of hours but
Acc2000 starts counting again every 24 hours. In decimal format I can see
that all the hours are there. How do I show all the hours?

e.g: how many hours is 92.99999999999998 ?

TIA Henro
 
K

Ken Snell

You don't describe what you're actually adding, but I'll assume that it's
the time portion of a date/time format? If so, then the sum you have is
probably meaningless, as time is stored as a fraction of 24 hours in a
date/time field, not as hours.

Give us more details about what you're actually storing in the field so that
we can suggest how to do what you want to do.
 
H

Henro

An example:

DayStart 08:30
EndDay 17:00
Lunch (Endday-Daystart)- Lunch

Per day this works fine. But as I sum more days and the total of hours is
more than 24:00 I get strange values. 26:00 working is shown as 2:00

This is the result of the way Access stores times, but how do I convert them
back to 26 hours?

Henro
 
K

Ken Snell

Use the DateDiff function to get the actual number of hours for each day,
and then sum those values. Actually is best to calculate the number of
minutes and convert those to hours.

HoursForOneDay = DateDiff("n", [DayStart], [EndDay]) / 60

If Lunch is in total minutes (say, 30), then you can subtract those minutes
before you divide by 60:

HoursForOneDay = (DateDiff("n", [DayStart], [EndDay]) - [Lunch]) / 60

Then you can sum HoursForOneDay to get the total number of hours.
 

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