Datetime first monday of month


I have first day of the month saved in a datetime variable. Next i should check if it’s monday = all good. If not it should search next monday and return its date.

Found php solutions from google and got kind of close. This for example echo date(“j, d-M-Y”, strtotime(“next monday”)); Does not work in Uipath though so decided to ask some help.

Hello @Mikko_S,

This is my solution: Today.AddDays((DayOfWeek.Saturday-Today.DayOfWeek)+2).DayOfWeek.ToString
Today.DayOfWeek (ex: Friday) =6
.DayOfWeek = Monday (you can use other function to display the final result)

Hope that will help you.

Thank you!
Also found this ready element that comes handy! How to get Last, First Monday of this Month


Check this xaml,
It will return first Monday of the year, month passedMain.xaml (4.7 KB)

1 Like

This one looks really elegant option. Thank you! :slight_smile: