On the Microsoft Flow community site I found an interestig question about finding the first working day of the month using Microsoft Flow.
So I thought I’ll take that challenge!
First of all I need a date. (No not that kind of date!).
As this is a test flow I’m using a manual start of the flow to collect any date from the user starting the flow.
This will give me the DateInMonth as shown below. in the format of 2013-01-18. Then I’ll replace the day with 01 and I’ve got the first day of the month.
Easy, just a bit of text cutting and replacing and we’re done.
The following expression does the trick:
Then we need to check if this day is a holiday. I took the 2013-01-18 date here so that I’ve got a holiday being returned for the first of the month.
I found a web service that can give me the UK bankholidays at
So now I can check with a simple condition of the first day of the month is a holiday or not.
The condition will simply look like this:
@greater(indexOf(body(‘HTTP’), variables(‘FirstDay’)), 0)
Ok. This is easy but we haven’t got the weekends covered yet.
This is where flow has an answer out of the box. With the following expression using the dayOfWeek function your done in no time:
Now all we need to do is increment the 1st day of the month to the 2nd day of the month and rerun our tests until we have found working day.