First and Last Day of the Week Calculations Power Automate

Automatically Calculate the First and Last Day of a Week in Power Automate.

When working with dates in Power Automate, calculating the start and end of the week for a given date is a common requirement. However, it's important to remember that the dayOfWeek() function in Power Automate assigns 0 to Sunday and 6 to Saturday by default.

If you want your week to start on Monday and end on Sunday, you can use the following expressions:

📅 Start of the Week (Monday):
formatDateTime(addDays(utcNow(), sub(1, dayOfWeek(utcNow()), 1)), 'MMMM-dd-yyyy')

📅 End of the Week (Sunday):
formatDateTime(addDays(utcNow(), sub(7, dayOfWeek(utcNow()))), 'MMMM-dd-yyyy')

How These Work:

✅ Start of the Week (Monday) – The dayOfWeek() function returns 1 for Monday, so we subtract that value from 1 to reset the date back to Monday.

✅ End of the Week (Sunday) – Since dayOfWeek() gives 6 for Saturday, subtracting from 7 pushes the date forward to Sunday.

This approach ensures your calculations align with a Monday–Sunday week structure, even though Power Automate defaults to a Sunday–Saturday structure.

Sam Oakes

Web designer based in Harrogate, North Yorkshire

https://gobocreative.co.uk
Previous
Previous

Adaptive Card Approvals in Outlook - Part 1