How to add 5 business days to the date

Hi,

The best solution for this would be a especific workflow.

In my case i build a “GetNextNWorkDay” build a workflow:

2 in atributtes: 1. DateOrigin 2. Number of days
1 out atribute: 1. DateOut

Workflow should be like:
dateOut=dateorigin
for each Enumerable.Range(0,Math.Abs(Number of days))
do
dateOut = dateOut.AddDays(NumberOfDays/Math.Abs(Number of days)) Note: this will work forwards and backwards if only want one direction just place +1 or -1.
while ({DayOfWeek.Saturday,DayOfWeek.Sunday}.tolist.contains(dateOut.Contains(dateOut)
end for each

this will work :slight_smile:

In order to explain it a little bit further:

  1. It will get next work day N times but it will count only workdays between N.

This oslution works with holydays if you add a list of Date as input and add something like (listHolydays.Contains(DateOut.Date) in the while condition

5 Likes