Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you calculate the sum of time periods?

Status
Not open for further replies.

grobertson

Technical User
Jul 4, 2001
3
US
I am trying to calculate the sum of several time periods. I found a formula to calculate the difference between two time periods, that formula is

Format([StartTime]-1-[EndTime], "Short Time").

The query I am trying to design needs to take the tracked time for a process from each day of the week and come up with a total. Each day of the week is a different field, such as Montime, Tuestime, Wedtime, etc, so the formula needs to take the value from each field, and sum them and display it in the total field of the query.
Thank you.
grobertson1@msn.com
 

What is the datatype of MonTime, TueTime, ...? The correct syntax will depend somewhat on the data type. However, a sample of the general syntax for doing what you've asked follows.

Select
MonTime, TueTime, WedTime, ...,
(MonTime+TueTime+WedTime+...+SunTime) As TotTime
From mytable Terry
Please review faq183-874.

"The greatest obstacle to discovery is not ignorance -- it is the illusion of knowledge." - Daniel J Boorstin
 
grobertson,

another issue might be the structure of your db / table. The use of multiple time fields in the single record for the same item (MonTime, TueTime ...) does not appear to be reasonably normalized. MichaelRed
mred@att.net

There is never time to do it right but there is always time to do it over
 
For the addition of time problem, the data type is Short time.
Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top