Adding times to get a total.

Darren26

Registered User.
Local time
Today, 17:41
Joined
Jul 12, 2005
Messages
18
Just practicing at the moment, but i have a query that stores durations in hours\minutes\seconds

Anyway i want the query to add these times up and give me a total. For example 01:00:00 and 01:00:00 would total up to 02:00:00. Hoever when i use the sum function within the query, i get 0.0833333333333333.

Any idea why and do i have to format the field within the query to recognise it as a Time and not a number?
 
This is because time is actually stored as a fraction of a day. Access just formats it pretty for you. When you try to add them or do some other type of math with them, what you get back is the fraction of a day. Multply your result by 24.
 
pdx_man is correct, but if you want to store durations you would be well advised to avoid using a date/time datatype. Store a numeric value that records your times as a number of seconds (or minutes if that is more appropriate) and covert this to display whatever you want after you have done all the calculations.
 

Users who are viewing this thread

Back
Top Bottom