Forum Discussion
michael_laan
6 years agoFrequent Visitor
Calculating Working Hours Between Business Hour Dates Excluding Weekends
I was have been trying to come up with a calculation for working hours between two dates, exlcuding weekends and non-working hours. Additionally the calculation needed to adjust the actual start and...
STIMIL
6 years agoFrequent Visitor
Hi Michael,
In your code, below variables were initialized but never used, are they not needed to be used? I see for some dates I'm getting -ve values. Such as, 4/17/2020 11:59:27 PM -> 4/18/2020 12:01:14 AM for start and end time as 8am to 5pm.
// Set Work Hours for Created & Modified Dates VAR DocumentFirstDateOnlyStart = DocumentFirstDateOnly + TIME(08,00,00)
VAR DocumentLastDateOnlyEnd = DocumentLastDateOnly + TIME(17,00,00)
Thanks, Stimil
michael_laan
6 years agoFrequent Visitor
Hi STIMIL ,
I believe I added the variables for testing and never removed them. I would highly recommend looking at the accepted solution for my post though, the code from Greg_Deckler was much cleaner and provided the same results.