Forum Moderators: coopster

Message Too Old, No Replies

Calculating business hours worked

between to dates

         

RussellC

3:15 pm on Feb 15, 2006 (gmt 0)

10+ Year Member



I have figured out how to calculate the number of weekdays minus weekends between 2 dates but what i need to do is get a little more detailed. I have been searching around for a function to do this but i cant find one and I cant quite figure it out on my own. I want to take 2 dates and figure out the number of hours between the 2 dates that are in between 8am and 5pm on weekdays. For Example

3/3/04 and 5/4/04 1487.8 hours total
then I need to subtract all the hours on the weekends
then I need to subtract the night time hours after 5pm and before 8 am.

Any ideas or links to solutions?

Thanks for the help

jatar_k

5:17 pm on Feb 15, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



>> I have figured out how to calculate the number of weekdays minus weekends between 2 dates

then you already have your answer

take the resulting number of days and multiply by the number of hours of work per day and you should have it.

unless i missed something

RussellC

5:34 pm on Feb 15, 2006 (gmt 0)

10+ Year Member



I was doing that and I was thinking it would not be that accurate because I need to take out specific time ranges. Pretend that the time between dates was 187 hours, and the first date started at 5:00am on Monday. How can I write something that will make sure the first 3 hours are not counted towards the total hours worked. The only hours counted are 4th hour through the 11th hour then the whole night is excluded, etc...

I will go back to the drawing board and try to work on this some more.

RussellC

5:35 pm on Feb 15, 2006 (gmt 0)

10+ Year Member



I think i just got what you are saying. I think I am making this more difficult than it has to be.

jatar_k

5:46 pm on Feb 15, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



just looking at it backwards I think