cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Time difference calculation excluding weekends

ahouston
New Contributor II

Does anyone have a pattern available to determine difference between two timestamps and add the duration to another timestamp, both of which calculations would exclude weekends?

For example, three inputs and one output:

  1. Baseline start timestamp
  2. Baseline end timestamp
  3. Target start timestamp

Logic would find the time diff between 1 and 2, excluding weekends and add that time to 3, excluding weekends to land on target end timestamp.

For example, using reference range of last Friday 1/28 until Thursday 2/3 and target start of Friday 2/4. The 4 day difference would be calculated and added to 2/4 - excluding the coming weekend, result would be Thursday 2/10.

Thanks!
Adam

1 ACCEPTED SOLUTION

bojanvelevski
Valued Contributor

We can add some specific number of days to this calculation, which is basically a failsafe mechanism for picking up working days. Before it was just multiplying the difference, just to be sure, but adding, letโ€™s say 4 days will help the logic to cover this edge cases.

image

Or we can complicate the second expression by adding more logic to it, again regarding the exclusion of the non working days.

I did some unit testing and it seems fine, but you can try more scenarios with both fixes and let me know if we need more updates.

Dates Difference Updated_2022_02_03.slp (8.1 KB)

View solution in original post

5 REPLIES 5

ahouston
New Contributor II

This is excellent and seems to do exactly what I needed. Thank you very much!