Forum Discussion

kumar25's avatar
kumar25
New Contributor II
2 years ago

Difference between 2 dates, excluding weekends

I have 2 date values, have to find the difference between both of them. Weekends to be excluded.

I am using the below expression to derive the value.

parseInt((Date.parse($Date2.toString())-Date.parse($Date1.toString()))/(1000*60*60*24)*0.71)

This logic is failing when

1. Date1 and Date2 are in the same week(for example 15/01/2024 and 19/01/2024)

2. Date 1 and Date2 are in different weeks but the difference is less than 7 days(19/01/2024 and 24/01/2024)