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

Number of Work Days between two dates

angeli2
Deputy Chef I
Deputy Chef I

hello ๐Ÿ‘‹,

I just wanted to ask if anyone has any recommendations for a Recipe.

I'm trying to get the number of business days between two dates. The additional challenge is also to exclude holidays.

Do you have any tips? much appreciated.

1 REPLY 1

timwolfe
Deputy Chef I
Deputy Chef I

To calculate the number of business days between two dates while excluding holidays, you can build a Workato recipe using a combination of triggers and actions.

Here's a simple pseudocode for the logic:

business_days_count = 0
(start_date..end_date).each do |date|
unless date.saturday? || date.sunday? || holidays.include?(date)
business_days_count += 1
end
end