Last week, I was working on a flow and faced a common issue: date formats. I needed to send an email with the date in a specific format, something like “12th Nov 2024, 07:45 AM,” so it would be easy for the end user to read. Additionally, I needed the date to display differently depending on certain conditions, like “st,” “nd,” “rd,” or “th” based on the day of the month.
Then, I researched and found that I can achieve this by using the if() and formatDateTime() function in Power Automate. In this tutorial, I will explain how to use formatDateTime() function in Power Automate with various useful examples.
Power Automate formatDateTime() Function
The formatDateTime() function in Power Automate changes the format of a date or time. You can use it to display the date or time in a specific way, like changing the format from “2024-11-12” to “November 12, 2024” or “12/11/2024.”
For example, if you have a date value and want to show it in a custom format, you can use this function to specify how it should look. You can change it to show just the year, month, day, or even the time in a 12-hour or 24-hour format.
Syntax:
formatDateTime(timestamp, format, locale)
- timestamp: This is the date or time you want to format. It can be from a field or variable, like utcNow(), triggerOutputs()?[‘created’], or any date value.
- format: This is a string that defines the format pattern. You use format codes like yyyy, MM, dd, HH, etc., to specify how you want the date or time to look.
- locale: The locale parameter formats dates according to specific regional settings. For example, “en-US” formats dates in the U.S. English style, while “fr-FR” applies French formatting rules.
Power Automate formatDateTime() function with utcNow()
Suppose you have a flow that moves daily reports from SharePoint to OneDrive. You want each file to include the current date in its name to make it easy to identify when each report was created.
To do this, follow the below steps:
1. Navigate to the Power Automate Home page, click + Create, and select the Scheduled Cloud Flow. Then provide the following information:
- Starting: Provide on which date you want to run your flow.
- at: Provide the time you want to run the flow, in my case, at 10:00 AM.
- Repeat every: We want to run the flow every weekday, so here, select 1 week.
- On these days: Select the Weekdays, i.e., Monday to Friday.

2. Add the Get files action to retrieve the report file. Provide the Site Address and Library Name.

3. Next, add the Get file content action. Provide the Site Address and select File Identifier from the dynamic content of the Get files action.
It will automatically add a for each loop.

4. Inside the for each add create file action from OneDrive for business action and provide below parameters:
- Folder Path: Choose the folder where you want to store the report file.
- File Name: Provide the below expression:
concat(formatDateTime(utcNow(),'yyyyMMdd'),'.pdf')- File Content: Provide file content from the Get file content action.

Before testing the flow, ensure a file is in the document library.

Now, it’s time to save the flow. Click on Test -> Select Manually -> click Test.

After the flow runs successfully, go to OneDrive, and you will see the files successfully created with the current date name.

Formatting Date in Power Automate Using formatDateTime() Function
I will show you some formatting dates and times using the formatDateTime() function in Power Automate.
In Power Automate Instant cloud flow, add an Initialize Variable action and set the variable’s name, type, and value. For this example, I want user-friendly date formats like Tuesday, November 12, 2024.
You can create a variable named varCurrentDate of type ‘String’ and set the below value:
formatDateTime(utcNow(), 'dddd, MMMM dd, yyyy')
When you run this flow, you will see the format like below screenshot:

Power Automate Formatdatetime Locale
Imagine you have a flow that sends emails when a ticket updates in a SharePoint list. Since your clients are in different regions (the United States, the United Kingdom, and Germany), you want each email to display the date in the client’s local format and language.
In this example, I’ll show you how to use a Compose action, which you can include in your email.
Now create a Power Automate Instant cloud flow, add a compose action, and provide the below expression for the United States:
formatDateTime(utcNow(),'D','en-US')Here, ‘D’ is a format string for the long date pattern.

After running the flow, you will see the format below screenshot:

If you want German, you can provide the below expression:
formatDateTime(utcNow(), 'D', 'de-DE')The output of the above expression:

Below is a table that provides some other locale in Power Automate:
| Locale | Output | Description |
|---|---|---|
| en-IN | Tuesday, 12 November 2024 | Indian English |
| fr-FR | mardi 12 novembre 2024 | French |
| it-IT | martedì 12 novembre 2024 | Italian |
| es-ES | martes, 12 de noviembre de 2024 | Spanish |
| en-GB | 12 November 2024 | British English |
Power Automate Formatdatetime 24 hours
For a 24-hour clock format in Power Automate, we will use HH:mm or HH:mm:ss, depending on whether you want to include seconds.
- HH:mm: This formats the time to a 24-hour clock without seconds.
- HH:mm:ss: This formats the time to a 24-hour clock with seconds included.
If you want to get the current time (in UTC) in a 24-hour format without seconds, you can use the below expression:
formatDateTime(utcNow(), 'HH:mm')
Similarly, if you want the 12-hour clock format, use hh:mm tt or hh:mm:ss tt, depending on whether you wish to include seconds.
- hh:mm tt: Formats the time using a 12-hour clock, including the AM/PM indicator.
- hh:mm:ss tt: Includes the seconds along with the 12-hour clock format and AM/PM
If you want to get the current time (in UTC) in a 12-hour format with seconds, you can use the below expression:
formatDateTime(utcNow(), 'hh:mm:ss tt')This will return the date and time in a format like:

Power Automate Formatedatetime Day of Week
Now I will tell you how to use the formatedatetime() function to get a day of the week in Power Automate.
To get the day of week in Power Automate, we will use two formats:
- dddd: This represents the full name of the day of the week (like Monday or Tuesday).
- ddd: This represents the abbreviated name of the day of the week (like Mon or Tue).
If you want to display the current date with the full day name, you can use the below expression:
formatDateTime(utcNow(), 'dddd, MMMM dd, yyyy')
The output of the above expression is below screenshot:

Power Automate formatDateTime() function to format the date including Date and Time
Here, I want to display the day of the month and add the appropriate suffix, such as “st,” “nd,” “rd,” or “th,” depending on the day. For example, it would display “1st,” “2nd,” “3rd,” or “4th,” and for special cases like the 11th, 12th, and 13th, it always adds “th.”
After the day is formatted with the correct suffix, the expression then formats the rest of the date to display the month and year, followed by the time in a 12-hour format with AM/PM.
Create an Instant cloud flow, provide the flow name, and choose the flow trigger (manually trigger a flow). Then add Compose action and use the below expression:
concat(
formatDateTime(utcNow(), 'dd'),
if(or(and(greaterOrEquals(int(formatDateTime(utcNow(), 'dd')), 11), lessOrEquals(int(formatDateTime(utcNow(), 'dd')), 13)), equals(mod(int(formatDateTime(utcNow(), 'dd')), 10), 0)), 'th',
if(equals(mod(int(formatDateTime(utcNow(), 'dd')), 10), 1), 'st',
if(equals(mod(int(formatDateTime(utcNow(), 'dd')), 10), 2), 'nd',
if(equals(mod(int(formatDateTime(utcNow(), 'dd')), 10), 3), 'rd', 'th')))),
' ',
formatDateTime(utcNow(), 'MMM yyyy, hh:mm tt')
)
- formatDateTime(utcNow(), ‘dd’): This part gets the current day of the month as a two-digit number (like 01, 02, 11, etc.).
- if(or(and(greaterOrEquals(int(formatDateTime(utcNow(), ‘dd’)), 11), lessOrEquals(int(formatDateTime(utcNow(), ‘dd’)), 13)), equals(mod(int(formatDateTime(utcNow(), ‘dd’)), 10), 0)), ‘th’, …): here I check if the day of the month is between 11 and 13 or if the day ends with a “0” (like 10th, 20th, 30th). If that condition is true, then assign the suffix “th.”
- If (equals(mod(int(formatDateTime(utcNow(), ‘dd’)), 10), 1), ‘st’, …): Here, I check if the day ends with a “1” (like 1st, 21st) then assigns the suffix “st.”
- if(equals(mod(int(formatDateTime(utcNow(), ‘dd’)), 10), 2), ‘nd’, …): Here, I check if the day ends with a “2” (like., 2nd, 22nd) then assigns the suffix “nd”.
- if(equals(mod(int(formatDateTime(utcNow(), ‘dd’)), 10), 3), ‘rd’, ‘th’): Here, I check if the day ends with a “3” (like 3rd, 23rd) then assigns the suffix “rd”. Otherwise, it assigns “th” for any other day.
Now, it’s time to save the flow. Click on Test -> Select Manually -> click Test. After the flow runs successfully, you can see the date format:

Here, I am using unNow(). You can use any other things like the sharepoint date column.
In this tutorial, I covered how to use the formatDateTime() function in Power Automate to format dates in different ways. We also learned how to create custom date formats, such as adding suffixes (“st,” “nd,” “rd,” “th”) to the day, displaying dates in 12-hour or 24-hour time formats, and applying locale-specific formats for different regions.
Related Power Automate tutorials:
- Power Automate isInt() Function
- Power Automate concat() Function
- Power Automate utcNow() Function
- Power Automate indexOf() Function
- Power Automate dateDifference() Function

After working for more than 18 years in Microsoft technologies like SharePoint, Microsoft 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (12 times). I have also worked in companies like HP, TCS, KPIT, etc.