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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to calculate total hours ?

Status
Not open for further replies.

Metoo

Programmer
May 22, 2000
2
ID
How to calculate the total hours like :<br>&nbsp;&nbsp;15:00 + 12:30 + 10:15 + 7:45<br>Since, when the total hours is more than 24:00<br>it becomes 0:00.<br><br><br>
 
So if the hours is more than 24 you want it to roll over to 1 Day?<br>There are several Date functions at your disposal:<br><br>DateDiff<br>DateAdd<br>DatePart<br>DateSerial<br>Now even though it says &quot;DATE...&quot; it will still add just hours and minutes.<br><br>Look at the &quot;Format&quot; Function too.<br><br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
The problem relates to a confusion between a Date/Time (which is a fixed point) and a duration (like 3 hours to accomplish a task).<br><br>You should NOT store durations as Date/Time.&nbsp;&nbsp;Store them as Number (Double).<br><br>You can then enter 15 hours and 30 minutes as 15.5 hours. <p>Jim Conrad<br><a href=mailto:jconrad3@visteon.com>jconrad3@visteon.com</a><br><a href= > </a><br>
 
Anyway thanks for the answer. <br><br>Simply speaking, I want to make a program that calculates <br>total hours of employees working overtime in 1 month. <br><br>The data is inputted daily, from and until what time does<br>that employee working overtime. Such as : From 15:00 to 19:15. In this case that employee works for 4:15 hours.<br><br>In one month (or in a couple of month) it will become more<br>than 24:00. <br><br>Since I'm a novice in access. Is there anyone have an idea<br>to solve that problem. <br><br>Thanks for the attention. <br>
 
In a query, add this expression:<br><br><FONT FACE=monospace><br>ElapsedTime:[EndTime]-[StartTime]*24<br></font><br><br>This will give you the number of hours (and fractions of hours).&nbsp;&nbsp;In your example, ElapsedTime = 4.25 hours <p>Jim Conrad<br><a href=mailto:jconrad3@visteon.com>jconrad3@visteon.com</a><br><a href= > </a><br>
 
I know its already been said but like jim said above store the numbers as a double number field in decimal.... it makes things much easier
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top