← Al Davies, 250 High Street

How to get the day of the week from a date in Power Automate

Use dayOfWeek(date) to get the day as a number, where Sunday is 0 and Saturday is 6. Use formatDateTime(date, 'dddd') to get the day name, such as Thursday.

What does dayOfWeek() return?

dayOfWeek() takes a timestamp and returns a whole number. Sunday is 0, Monday is 1, and so on up to Saturday, which is 6.

Microsoft's own example shows dayOfWeek('2018-03-15T13:27:36Z') returning 4. March 15, 2018 was a Thursday, so 4 means Thursday.

Add a Compose action and paste: dayOfWeek(triggerOutputs()?['body/DueDate']). Replace DueDate with your own column name.

How do you get the day name, such as Monday?

Use formatDateTime with the format dddd. For example, formatDateTime(utcNow(), 'dddd') returns the full day name for today. Microsoft's example formatDateTime('01/31/2016', 'dddd MMMM d') returns Sunday January 31.

Use ddd for the short name, such as Thu. Both formats come from the .NET custom date format patterns that Power Automate uses.

How do you show the day name in another language?

formatDateTime accepts a third value, the locale. The call formatDateTime('01/31/2016', 'dddd MMMM d', 'fr-fr') returns dimanche janvier 31. If you leave the locale out, Power Automate uses en-us.

How do you check if a date falls on a weekend?

  1. Add a Condition action and switch to the advanced mode.
  2. Paste: or(equals(dayOfWeek(utcNow()), 0), equals(dayOfWeek(utcNow()), 6)).
  3. Replace utcNow() with your own date if you check a column.
  4. The Yes branch runs on Saturday and Sunday. The No branch runs on weekdays.

Why is the day of the week wrong by one day?

  1. utcNow() returns UTC time. Late in the evening in the US, UTC is already the next day. Convert the time first with convertTimeZone(). See our guide on formatDateTime and time zones.
  2. A SharePoint date-only column can shift by a day when it is read as UTC. Convert it to your zone before you call dayOfWeek().
  3. You expected Monday to be 0 or 1 with Sunday last. Power Automate counts Sunday as 0. Adjust your Switch or Condition values.

Why does the expression fail or return an empty value?

  1. The date column is empty. Wrap the value in coalesce() or test it first. See our guide on Condition field is empty.
  2. The text is not a date format Power Automate can read. Convert it first with parseDateTime(), which reads a text date in the locale or format you give it.
  3. The error says InvalidTemplate. Check the quotes and brackets in the expression.

How do you use the day number to run different steps?

Add a Switch action and use dayOfWeek(utcNow()) as the On value. Add one case for each number, such as 1 for Monday.

To run a flow only on weekdays, you do not need a day check. Set the trigger instead. See our guide on Recurrence on weekdays only. To move a due date past weekends, see add business days to a date.

FAQ

Is Sunday 0 or 7 in Power Automate?

Sunday is 0. Saturday is 6.

How do I get the day name instead of a number?

Use formatDateTime(date, 'dddd'). It returns a name such as Thursday.

Does dayOfWeek use my time zone?

It reads the timestamp you give it. utcNow() is UTC, so convert the time zone first if your local day differs.

Sources