How to calculate total number of WEEKDAYS between two dates?
Custome activity I used is giving me incorrect result. I want to exclude Saturday and Sunday.
Hi @7387023380 - If you are allowed to use external package…Please try this…
Hi @sarathi125 …Thanks…but it is printing all dates between 2 given dates…but the user asked only for business days excluding weekends…Do we have to tweak your flow?
We can check if the day of the date is Saturday and Sunday we can ignore those days.
Check this xaml, included to ignore Saturday and Sunday
GetDatesBetween2Dates.xaml (6.7 KB)
I have tried this package… It is I guess including Saturday in working days… in calculation it is giving one day more than weekdays.
Thanks @sarathi125 … I only want the number of weekdays between two dates in INT format… how can I get this…?
@7387023380 - Nope…its working fine…Please have a look here…You can see it did not printed 20 and 21.
Check this below code, @7387023380
TotalDays = 1 + ((Cdate(“02/14/2021”) - Cdate(“02/01/2021”)).TotalDays * 5 - (CDate(“02/01/2021”).DayOfWeek - Cdate(“02/14/2021”).DayOfWeek) * 2) / 7.
And code is in the form of,
TotalDays = 1 + (EndDate - StartDate).TotalDays * 5 - (StartDate.DayOfWeek - EndDate .DayOfWeek) * 2) / 7.
EndDate and StartDate should be in - “MM/dd/yyyy” format
This will give you the total days excluding the Saturday and Sunday.
Hope this may help you
Update the workflow to get only Weekend counts.
GetWeekendCount.xaml (8.7 KB)
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.