Skip to main content

Today's date, get the current time

This time, I will explain how to get today's date and current time.

"Get the current date" action details

This time, we will use the action "I will get the current date".

The action has the following parameters.

Parameter namevalue
ObtainSelect whether to get the current date or to get it up to time
Time zoneSelect whether to use the OS standard time zone or to get a time zone by specifying the country
country/areaIf you select "Specific Time Zone", select a country to get the time zone
Generated variablesVariables that store the created date information

action

Unless otherwise specified, the time zone is not a problem in the system time zone.

implemented with copy and paste

This time, as a sample, we have obtained the date and time at the time of execution, and prepared a flow to store time and minutes in another variable.

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
Text.ConvertDateTimeToText.FromCustomDateTime DateTime: CurrentDateTime CustomFormat: $'''HH''' Result=> CurrentHour
Text.ConvertDateTimeToText.FromCustomDateTime DateTime: CurrentDateTime CustomFormat: $'''mm''' Result=> CurrentMinute

Power Automate Desktop is implemented

  1. From "Search for action", enter "Get the current date".

  2. Set the parameter as follows

    Parameter namevalue
    ObtainCurrent date
    Time zoneSystem time zone
    Generated variablesCurrentDateTime
  3. By execution, today's date and current time are stored in the variable.

The exception that can occur

If the date information cannot be obtained for some reason, an error will occur.

In addition, it can be entered in the time zone with free words and does not cause an error before execution, but it will be an error if it is a country/region that does not exist at runtime.

We recommend that you implement block processing.

Operate the date

The variable acquired in this action is a DateTime type, and it takes some ingenuity to extract or process data.

Please refer to other pages about how to use it.