How to Get Current Date in Power Automate?

In this Power Automate tutorial, I will explain how to get the current date in the Power Automate flow by using the utcNow() function. In addition to that, I will also describe how to customize different formats of date and time as mentioned below:

  1. Get the current date in Date -Month-Year format
  2. Get the current date in Year-Month-Date format
  3. How to get current date with time in Power Automate
  4. Get the current date in Day of the week, Month day, Year (Ex: Thursday, June 11, 2023)
  5. Get a current date in Month Day, Year format (Ex: Oct 16,2023)
  6. Power Automate how to retrieve the current date in MM/dd/yyyy with 12 hours of time indicator
  7. Obtain the current date in dd/MM/yyyy format with a 24-hour time indicator
  8. Get the current date in yyyy/MM/dd Format in 12 hour time indicator

Power Automate Get Current Date

In Power Automate, the formatDateTime function is available to get the current date using utcNow in a flow.

When working with date and time values in Power Automate, we can see the date and time will not be in a specific format according to our requirements. For that, Microsoft is providing the formatDateTime() function to customize our required date format.

The below table will represent some of the different formats that can be used in the formatDateTime ()function:

FormatDescriptionOutput
yyyyyear2023
MMMMMonth nameOctober
ddday11
yyyy-MM-ddYear-Month-Day2023-10-12
yyyy-MM-ddTHH:mm:ssZDate and Time2023-10-12T14:30:00Z
HH: mm12 hour time indicator with AM/PM02:30PM
HH:mm24-hour time indicator 14:30
MMM dd,yyyyMonth Day, YearJul 16, 2023

A step-by-step guide to get the current date in different formats of Power Automate flow:

I have created an instant cloud flow in Power Automate for all the examples.

1. Get the Current Date in Day-Month-Year Format

To get the current date in day-month-year format, do the following things.

  • On the instant cloud flow, add initialize a variable and fill in the below-mentioned details:
    • Name: Provide a name for the variable
    • Type: Set data type as ‘String’ from the drop-down
    • Value: Provide the expression that is given in below code:
formatDateTime(utcNow(),'dd-MM-yyyy')
How to get the current Date in Power Automate
  • Next, add a Compose data operation and select the input that is generated from the initialized variable as shown below:
@{variables('Current Date')}
Get the current Date in Power Automate

Output:

Obtain Current date and year in Power Automate flow

2. Get the Current Date in Year-Month-Date Format

  • In the initialized variable, select the Value that is given in the below code:
formatDateTime(utcNow(),'yyy-MM-dd')
Obtain Current date and year in Power Automate
  • To see the output, add Compose action and take Inputs from variables as shown below image:
@{variables('Get Current Date')}
Get Current date in various formats in Power Automate

Output:

Retrieve current date in Power Automate

3. Get the Current Date with Time

  • In the initialized variable, select the below details:
    • Name: Enter the name of a variable
    • Type: Select datatype from drop-down
    • Value: Give the below expression in the value section.
formatDateTime(utcNow(),'yyyy-MM-ddTHH:mm:ss')
How to get current date in various formats in Power Automate
  • Add a Compose action and set the below details:
    • Inputs: Select output under variables of dynamic content.
@{variables('Get Current Date and Time')}
How to get the current Date Time in Power Automate

Output:

Get current date and time function in cloud flows

4. Get a Current Date in Day of the week, Month day, Year Format

  • In the initialized variable, set the Value as given in the below code:
formatDateTime(utcNow(),'dddd,MMMM dd,yyyy')
Extract Day of week from dates in Power Automate
  • Take a Compose action to check the output as shown below:
    • Inputs: Select from variables of dynamic content
@{variables('Current Date')}
Create a variable to get the current date in Power Automate

Result:

Power Automate Return current date in various formats

5. Get a Current Date in Month Day, Year format

  • Set the Value as mentioned code in the initialized variable along with the below details:
    • Name: Provide a name manually for the variable.
    • Type: Select datatype as ‘String‘ from drop-down
formatDateTime(utcNow(),'MMM dd,yyyy')
Return current date in various formats in Power Automate
  • To display the output, add a Compose data operation as shown below:
@{variables('Current Date')}
Simplify Date and Time in Power Automate

Result:

Simplify current Date and Time in Power Automate flow

6. Get the Current Date in MM/dd/yyyy with 12 Hours Time

  • Set the expression that is provided in the code below in the Value column section:
formatDateTime(utcNow(),'MM/dd/yyyy hh:mm tt')

For yyyy/MM/dd format with 12-hour time:

formatDateTime(utcNow(),’yyyy/MM/dd hh:mm tt’) – With AM/PM Indicator
formatDateTime(utcNow(),’yyyy/MM/dd hh:mm’)- Without AM/PM Indicator
Power Automate get current date in various formats
  • To see the output, add a Compose action as shown below:
@{variables('Current Date')}
Power Automate get the current date in Microsoft flow

Output:

Power Automate flow to get the current date in Microsoft flow

7. Get the Current Date in dd/MM/yyyy with 24-hour Time

  • In the Initialized variable, set the below-given details:
    • Name: Give a name for the initialized variable.
    • Type: Set the datatype as ‘String‘ from the drop-down
    • Value: Provide the value as mentioned in the below code.
formatDateTime(utcNow(),'dd/MM/yyyy HH:mm:ss tt')
Use of Date and Time expressions in Power Automate
  • Add a Compose action to check the output and give below details:
    • Inputs: Select variables of an initialized variable from the dynamic content.
@{variables('Current Date')}
Power Automate get the current date with 24hour time format in Microsoft flow

Output:

How to get current date with 24 hour time format

This is how to get the current date and time in various formats using Power Automate.

Conclusion

I hope you got to know how to get the current date in Power Automate. And also how to customize various date and time formats using the formatDateTime function in Power Automate.

You may also like: