I am adding 2 inputs as Start and End date in the Manual trigger step, you can get the dates from any database or pass from other source

Initialize variable Start Date, and set the Start Date input value to this variable

Initialize New Date, we will set this variable in coming steps

Initialize Weekend days count, to store the count of the weekend days between 2 dates

Add do until step, and add variable start date is greater than input end date as below

Here we are doing a loop until the start date is greater than end date

Add condition , dayOfWeek() - this function returns 0-6 numbers where 0 is Sunday and 6 is Saturday

dayOfWeek(variables('StartDate'))

in true condition, we will increment weekend days count variable to 1

Note: You can initialize one more variable as Week days count and increment it in the false condition to get the week days count between two dates

After if condition, increment the start date variable by 1 day

addDays(variables('StartDate'),1,'yyyy-MM-dd')

Finally you can add compose step to see the count of week end days

Testing:

Run the flow, provide start and end dates and click on run flow

Result:

Hope its helpful..! 🙂


This free site is ad-supported. Learn more