Skip to main content

Get the day of the week

In Power Automate Desktop, it is not specified at the time of setting so that the user does not need to be aware, but there are multiple data types internally.

This time, I will explain how to get the day of the week using the DateTime type.

DateTime type

There are multiple properties in the DateTime type that can be set from actions such as "Acquisition of the current date".The contents are as stated below.

Property namecontent
YearYear (number)
MonthMonth (numbers)
DayDate (numbers)
DayOfWeekDay (string)
DayOfYearThe number of days from January 1st (numbers)
HourTime (number)
MinuteMinister (numbers)
SecondSecond (number)

Each property can be obtained by%variable name. If the variable name is Currentdate, specify in the form of%currentdate.year%.

You can get the day of the week by obtaining a dateofweek from this.

implemented with copy and paste

Copy the following code and paste it on the edit screen of Power Automate Desktop to add the target action.

DateTime.GetCurrentDateTime.Local DateTimeFormat: DateTime.DateTimeFormat.DateAndTime CurrentDateTime=> CurrentDateTime
SET Day TO CurrentDateTime.DayOfWeek

Power Automate Desktop is implemented

  1. Enter the "current date" from "Action Search" to create a DateTime type variable.

  2. Enter "Setting Variables" from "Action Search" and set the following parameters.

    Parameter namevalue
  3. When executed, the variable "WEEK" will set the day of the week.

I can get up an error

There is no error that is thrown by this action, so there is no need for error response.