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

time duration

Status
Not open for further replies.

cooksie

Technical User
Apr 22, 2005
2
US
I have need to calculate the time duration over several days, the result being hours and minutes. For instance: Employee "A"
starts work on 4/25/05 at 4:00 pm and ends his shift on 4/27/05 at 1:00 am. How do I calculate this?

Thank You in advance.

Chef F
 
This is a multi-step process and it is more complicated than you might think. Since you did not say which SmartSuite program you are using, I will just give you the "theory" here:

1) Determine the number of hours and minutes on the start day by subtracting the start time from midnight (24:00)

2) The number of hours and minutes on the end day is simply the time the employee stops working.

3) Determine whether more than one day has passed between the two date-time entries and add 24 hours for each day. You cannot simply use the day number because the employee may have worked across the end of a month or year. See if your product has a "DayOfYear" function and use it along with the year values in the two dates to determine the number of days elapsed and subtract 1. Then multiply the number of days by 24 to get hours.

4) Add the values from #1, #2 and #3 to get total elapsed hours and minutes.

Sue Sloan


 
Thank You, Sue! I'll try it Saturday while at the office. The application will be in Approach from SS 9.8, although using a table in WordPro might be an alternative.

Thanks again,

Chef F
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top