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 name | content |
---|---|
Year | Year (number) |
Month | Month (numbers) |
Day | Date (numbers) |
DayOfWeek | Day (string) |
DayOfYear | The number of days from January 1st (numbers) |
Hour | Time (number) |
Minute | Minister (numbers) |
Second | Second (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
Enter the "current date" from "Action Search" to create a DateTime type variable.
Enter "Setting Variables" from "Action Search" and set the following parameters.
Parameter name value setting Week address %CurrentDateTime.DayOfWeek% 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.