Sum of Time

adam.greer

Registered User.
Local time
Today, 12:32
Joined
Apr 27, 2006
Messages
43
Hi Guys

I've read a few different posts about adding time, but so far they have delt with different circumstances.

I have a query which pulls 30 random records, with a duration time attached to them.

I then want a second query to add all these records and give a total duration for these tracks. The time is in this format 00:04:03, but when I use the Sum expression in a query i get a result like this "0.0864699074074074"

Any ideas how I can get it to be displayed in hh:mm:ss?

Thanks guys
 
Perfect, thanks very much
 
I realised later that your sums may go over 24 hours and thus you would need to quote the days, just in case you don't know the days are before the decimal point and time after, therefore the use of the function Int([field]), will give the days, and Format([field]-Int([field]),"hh:mm:ss") will return the rest.

Brian
 
Hi
Sorry......where should this be put ? should it be within code...sorry I know this is going to have been a stupid question, so thanks in advance

Format([field],"hh:mm:ss")
 
I think we are going to need a bit more information as to what you are doing and what is the problem, for Adam it would have been in the field of the query, it might have looked something like
Expr2: Format((Sum([time1])-Int(Sum([time1]))),"hh:nn:ss")

Brian
 
TimeFormat

Thanks for your reply Brian, I am working on a time logging DB which is working ok in that it is recording time as an employee logs in and out, what I am trying to do is Sum the times ie I will run a report at the end of the month which can be selected for a period it will show the total number of Hrs,Mins,Secs worked during the period selected for each employee, I have an expression (from this forum of course..) in the forms qry which will total each entry

Expr3: Format([LogInTime]-1-[LogOutTime],"Long Time")

which seems to be working, so basically Sum of time worked in a selected period and selected employee

many thanks again
Fi
 

Users who are viewing this thread

Back
Top Bottom