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!

calculating time

Status
Not open for further replies.

chrisbass

Programmer
Oct 10, 2001
1
US
I have a form wich has time figured in by using "short time" and adds up my time card entries by military time, this calculates the time for 1 day and puts it in a seperate box like 12.23(hours & min) but I cant seem to take those boxes & add them to gether to give me a total of hours & min. worked in a week. I think I have tried everything to no avail, Please help. Thanks.
 
Try converting that amount to total minutes (12.23 = (12 * 60) + 23 = 93 minutes) and then add them all together. On the distant end, yoo will need to divide it back to give you your hours and minutes.

Hope that helps... Terry M. Hoey
 
I am somewhat confused. You show "12.23" and refer to this as short time (Hours and Minutes). But short time would nurmally have the ":" as the Hr Min seperator. Terry has followed your suggestion that the format is for 12 hours and 23 minutes, however I'm not sure it doesn't represent ~ 12 & 1/4 hours (12:13).

This is an important distinction, as it does determine wheather you need to do a bit of messy math or just add the values.


You can directly 'add' times in the "Short time" format.


[/i]This shows the table of the times. The [IncrTime] is date/time type with a "short time" format[/i]
IncrTime
3:26
2:12
1:22
1:22
1:06
0:59

[/i]This shows the simple query to sum the times[/i]
SELECT Sum(tblShortTime.IncrTime) AS SumOfIncrTime
FROM tblShortTime;

This shows the summed time formatted as time:
SELECT Format([SumOfIncrTime],"Short Time") AS TotTime_II
FROM qrySumShortTime;
MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Michael, I saw that too, but decided to go with what they had. I got the feeling that they may have thought it short time, but was actually a text field. I guess I should have mentioned something in my post.

Thanks for covering for me (again...) Terry M. Hoey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top