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!

Count hours between a range of time 1

Status
Not open for further replies.

spottednewt

Programmer
Jun 15, 2004
10
US
I need to find the number of hours in a range of time. I then need to add the hours to get the total hours for each person.

Right now I have [endtime] - [starttime] which gives me the range of hours in hours and minutes, like 4:30 for 4 hours and 30 minutes. My problem is that I can't add the ranges together to come up with totals. Something's goofy. I suspect that since it is really a time field that it starts over once it reaches 24 hours. So for a whole list of hours I get something like 12:00. Is there a way to convert the record result ([endtime]-[starttime]) to a number that is not time related so I can get an accurate total? Thanks!
 
Something like this ?
TotalTime: 24*Int(Sum([endtime] - [starttime]))+Format(Sum([endtime] - [starttime]),'h')) & Format(Sum([endtime] - [starttime]),':nn')

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hi,

Try DateDiff function using HOUR interval
[tt]
DateDiff("h",[Date1],[Date2])
[/tt]
:)

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top