Skip to content

Get the day of the week

Power Automate Desktop has several data types internally, although they aren’t shown explicitly when you configure actions, so users don’t need to think about them.

This article explains how to use one of them, the Datetime type, to get the day of the week.

The Datetime type, which you can create with actions such as “Get current date and time,” has several properties, listed below.

Property Meaning
Year Year (number)
Month Month (number)
Day Day (number)
DayOfWeek Day of the week (string)
DayOfYear Day of the year (January 1 is 1; number)
Hour Hour (number)
Minute Minute (number)
Second Second (number)

You can get each property with %VariableName.PropertyName%. If the variable name is CurrentDate, for example, you specify %CurrentDate.Year%.

By getting DayOfWeek from these properties, you can get the day of the week.

The string is returned in English, for example “Friday” for Friday and “Sunday” for Sunday.

Copy the following code and paste it into the Power Automate Desktop flow designer to add the actions.

DateTime.GetCurrentDateTime.Local DateTimeFormat: DateTime.DateTimeFormat.DateAndTime CurrentDateTime=> CurrentDateTime
SET Day TO CurrentDateTime.DayOfWeek
  1. In “Search actions,” type “Get current date,” and use the “Get current date and time” action to create a Datetime variable (CurrentDateTime).

  2. In “Search actions,” type “Set variable” and set the following parameters.

    Parameter Value
    Variable Day
    Value %CurrentDateTime.DayOfWeek%
  3. When you run the flow, the day of the week is set in the variable “Day.”

The “Set variable” action never throws an exception (error), so you don’t need any error handling.