Question Add 2 Hours to Date Value with Working hours Condition

naveensg

New member
Local time
Today, 00:01
Joined
Aug 3, 2012
Messages
7
Hello all,

I want to add 2 hours to Start Date/Time to get the Target Time, with the Condition of working hours. Let me explain with examples:

Workings hours 8:00 AM to 5:00 PM
Examples
1) Start Time : 7/13/2012 8:48 AM adding 2 hours will result 7/13/2012 10:48 AM
2) Start Time : 7/13/2012 7:48 AM (outside working hours) adding 2 hours will result in 7/13/2012 10:00 AM
3) Start Time : 7/13/2012 4:48 PM adding 2 hours will result 7/16/2012 9:48 AM (Sat & Sund should be ignored)
4) Start Time : 7/12/2012 9:48 PM (outside working hours) adding 2 hours will result in 7/13/2012 10:00 AM

I hope i have explained my question with these examples. I need a Code or formula to satisfy all these conditions.

Basically i am adding 2 hours to a date with Working hours & Working days Condition.

** Note: If the Code include Holiday Option then it would be great.

Thanks,
NG
 
John,

This DateAdd() function works like Sum function like adding 2 hours for any particular time. But what about working hours & working day condition? this function does not satisfy these conditions.

Regards,
Naveen
 
You'll need to use the DateAdd() function in conjunction with with some logical (If/Then) tests, as there is no native function to do this for you. You might find something in the Code Repository section of the forums.
 

Users who are viewing this thread

Back
Top Bottom