formatdatetime in Power Automate

Are you getting the unexpected format of date and time as you expected in a Power Automate Flow? And you need to format the date and time to get what you expected. Here, I will show you how to work with formatdatetime in Power Automate with real examples.

I will show you the following:

  • Power Automate formatdatetime() function with syntax.
  • How to use formatdatetime function in Power Automate to format date time in Power Automate.
  • How to work with utcNow() format in Power Automate.
  • List of formats available to use in formatdatetime function in Power Automate

formatdatetime in Power Automate

The formatdatetime function in Power Automate allows you to customize how date and time values are displayed inside a flow.

With the help of this function, you may provide a specific format that will be used to display date and time information regardless of the user’s locale or system preferences. This function returns the date and time in string format.

Let’s first see an example of how a date and time value looks in Power Automate without formatting.

formatdatetime power automate

In this Power Automate flow, we first initialize the variable “standarddatetime” and we set the current timestamp utcNow() as value for the variable “standarddatetime” and pass the same to the email body

power automate date format

Without any formatting, the email will look something like this, and it is not in the standard format; also, it is hard to read.

To get a decent or convenient date & time format, we use formatDateTime() function in Power Automate Flow. This is done by passing the DateTime value and formatting style to formatDateTime() function.

The format styles control the visibility and positioning of the month, day, hour, second, etc. of the DateTime value. Let’s understand how to format date and time values in a flow in Power Automate using some examples.

formatdatetime() in Power Automate Syntax

Here is the formatdatetime() in Power Automate syntax.

FormatDateTime(<Timestamp>, <Format>)

In this syntax

  • Timestamp: It is the date and time you want to convert to the required format.
  • Format: It is the desired format of date and time
See also  How to Apply Filter Between Dates in Power Automate?

Example: I have a timestamp i.e. ‘2023-10-25T13:56:02Z’, and I need to format it to ‘dd-MM-yyyy’, so the result will be 25-10-2023.

Let’s see an example where there is a requirement to display the Date and Time in an email inside a flow using Power Automate. To achieve that, we will use the format style ‘dd/MM/yyyy hh:mm tt in the above function.

power automate formatdatetime

So, we are passing the current timestamp as a string parameter and the required formatting style in the function and then setting our variable “standarddatetime” to pass it on in the email body.

Here is the expression:

formatDateTime(utcNow(),'dd/MM/yyyy hh:mm tt')

Once we run the flow, we will receive the below email with the date and time output.

format date time power automate

This is how to format date time in Power Automate. Let’s see more such examples of format date time in Power Automate.

How to use formatdatetime function in Power Automate

Here we will see how to use the formatdatetime function in Power Automate with a few examples.

Example 1. Format utcNow() in ‘yyyy-MM-dd’

To get the current date time we will use the function utcNow() which will return today’s date time in ISO 8601 format. Then we will format it to yyyy-MM-dd using formatdate time.

Now let’s see how we can do it in Power Automate.

1. Open Power Automate Cloud, click on +Create select Instant Cloud flow.

formatdatetime power automate

Then provide the flow name -> select Manually trigger a flow. Then click on Create.

formatdatetime in power automate

Now you can see the “Manually trigger a flow” flow action is added to the flow page.

 power automate formatdatetime

2. We will initialize a variable that will store the current date and time. For this, click on the +New step -> select Initialize variable action.

Provide the below information:

  • Name: Provide the variable name
  • Type: Provide the type as string
  • Value: Provide the below expression
power automate utcnow format

3. Now we will format the current date time to ‘yyyy-MM-dd’, for this click on the +New step -> select compose action. Then Provide the below information.

Inputs: Provide the below expression:

utcnow power automate format

4. Now run the flow manually and you can see the current date time is converted to the required format in Power Automate.

format date time in power automate

Example 2: Format date time to ‘yyyy-MM-dd hh:mm tt’

I have a date and time i.e. ‘2023-10-20T14:56:02Z’ and I need to convert it to this format ‘yyyy-MM-dd hh:mm tt’ in Power Automate. The output will be 2023-10-20 02:56 PM

See also  'The user does not exist or is not unique' error in Power Automate

To do this in the above flow in Power Automate. In the Initialize variable action, provide the date and time in the value field.

power automate format datetime

Then, in the compose action, provide the below expression in the Inputs field, like the below screenshot.

formatDateTime(variables('currdDateTime'),'yyyy-MM-dd hh:mm tt')
power automate date formats

Now run the flow manually and you can see the date and time are formatted in Power Automate.

date format power automate

Example 3: Power Automate format date dd/mm/yyyy

Let us see one example of “Power Automate format date dd/mm/yyyy”.

Now let’s see another formatting style; suppose we want to send only the date value in the email using Power Automate. To get the date value only, we will be passing the format style “dd/MM/yyyy ” in our formatDateTime() function.

Here, we are using the same variable we created in the above example and setting the current date value in ‘dd/MM/yyyy format.

power automate format date, power automate date format dd/mm/yyyy

Here is the expression:


After applying the format style of “dd/MM/yyyy“, we will receive the date and time value as 06/07/2024 in the email.

power automate format date

So, whenever date-only formatting is required in Power Automate, we will simply pass the format style ”dd/MM/yyyy to the function.

Example 4: Power Automate formatDateTime “MM/dd/yyyy”

In another example, where the date is required in “mm/dd/yyyy” format in email using Power Automate. First, we will initialize our variable as shown in the above example, and then set the variable “standarddatetime” with the formatted current date in ‘MM/dd/yyyy’ style and we will pass the variable in the email body.

format date power automate

Here is the expression:


After applying the above formatting style, we received the below email with the formatted date as 09/06/2024

power automate format date time, formatdatetime(utcnow() 'yyyy-mm-dd')

and that’s how to format the date in “MM/dd/yyyy” style in Power Automate.

This is how to use the formatDateTime() in Power Automate to format the date.

utcNow() format in Power Automate

Here we will how to format utcNow() in Power Automate.

See also  Argument 'Body' must be 'Binary' - Power Automate Desktop error

The utcNow() function is similar to Now()or Today(), which returns the current date time in UTC. The function utcNow() returns the current DateTime in the format of “yyyy-MM-ddTHH:mm:ssZ”. You will find the utcNow() function under the “Expression Tab” when adding data to input in Power Automate.



Example utcNow(yyyy-MM-dd) , it return ‘2023-10-26’

If you do not pass any format then it will return with the default format ‘yyyy-MM-ddTHH:mm:ssZ’, e.g. ‘2023-08-11T14:21:05.2031122Z’

Also, we can formatDateTime() and pass the utcNow() and provide the format to format the current date and time.

Now let’s see with an example how we can format the utcNow.

For example, we will convert the UtcNow() to ‘dddd, yyyy-MMM HH:mm tt’, and the result will be ‘Thursday, 2023-Oct 07:04 AM’

1. Open Power Automate Cloud, then click on +Create -> select Instant Cloud Flow.

utcnow format power automate

Then provide a flow name and select Manually trigger a flow action. Then click on Create.

utcnow() format

Now, you can see a manual trigger a flow action is added to the flow page.

utcnow() power automate format

2. Now we will format the utcNow, for this, click on the Compose action and then provide the below information:

  • Inputs: Provide the below expression
formatDateTime(utcNow(),'dddd, yyyy-MMM HH:mm tt')


utcNow('dddd, yyyy-MMM HH:mm tt')
utcnow() format in Power Automate

3. Now save and run the flow manually and you can see the date and time are formatted to the desired format.

utcnow() format Power Automate

List of Power Automate datetime format in formatDateTime function

Here we will see some of the formats that we can use to formatDateTime functions in Power Automate.

List of Formats for format DateTime in Power Automate

yyyyOnly year2023
yyyear last 2 digit23
MMonly month10
MMMMonth in shortOct
MMMMMonth in longOctober
ddonly day28
dddDay of week in shortFri
ddddDay of week in longFriday
‘yyyy-MM-dd’year month day2023-10-28
dd-MM-yyyyday month year28-10-2023
dd-MMMM-yyyyday- long month- year28-October-2023
dddd, dd-MMMM, yyyyday of week, day-Long Month, yearFriday, 28-October-2023
yyyy-MM-ddTHH:mm:ssZIS0 8601 format in power automate2023-10-20T14:56:02Z
HH24 hr format14-> 2 PM
hh12 hr format02-> 2 PM
HH:mm ttHour:minute AM/PM2:56 PM
gGeneral date time format of short time10/20/2023 2:56 PM
dGeneral date format of short date10/20/2023
ggShow eraA.D.

These are the list of formats you can use in formatDateTime() in Power Automate.


I hope from these real examples, you know now how to format date time in Power Automate. I have explained how to use the formatdatetime() in Power Automate. Also, we checked the list of Power Automate date formats available in the Power Automate formatdatetime() function. We also covered the below examples:

  • utcnow() format in Power Automate
  • Power Automate date format dd/mm/yyyy
  • formatdatetime(utcnow() ‘yyyy-mm-dd’)

You may also like: