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

Difference between 2 dates, excluding weekends

kumar25
New Contributor II

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)

2 REPLIES 2

AleksandarAngel
Contributor III

Hello @kumar25.

Attached below is a sample pipeline that you can use.

 

In general, as a short explanation, I was following the steps below:

  1. Calculate Days Diff between the Start and End Date.
  2. Generate all days in that interval.
  3. Filter out the weekends.
  4. Count the remaining days.

Let me know if you have any questions and if this helps you.

Regards,

Aleksandar.

kumar25
New Contributor II

Thanks @AleksandarAngel , it worked as required.