How to Format Dates and Times in Power Automate

Use formatDateTime() in a Power Automate cloud-flow expression to turn a timestamp into the date and time format you need. Start with a valid timestamp, choose a case-sensitive format pattern, and convert the time zone first if you need local time. This guide covers the flow setup, copy-ready expressions, and fixes for blank dates, unexpected output, and invalid inputs.

How Power Automate Date Formatting Works

The formatDateTime() function returns a formatted text string. It changes how a date appears; it does not update the original source field or automatically convert the timestamp to your local time zone.

The function’s argument order is:

formatDateTime(timestamp, format, locale)
  • Timestamp: Required. The date/time value, supplied as a string, dynamic content, or another expression.
  • Format: Optional. A standard or custom pattern describing the output.
  • Locale: Optional. A language-region code, such as en-US, that controls language and culture-dependent formatting.

For predictable output, specify the format explicitly. Use the locale argument when weekday names, month names, or regional date conventions matter.

Keep the original timestamp for date calculations and format a separate value for display. A human-readable date in an email is useful, but a localized text string is not a reliable replacement for the original timestamp in comparisons, sorting, or API requests.

How to Format Dates and Times in Power Automate

A Compose action gives you a convenient place to build the expression, inspect its result, and reuse that result elsewhere in the flow.

Step 1: Add Compose and Select the Timestamp

  1. Open your cloud flow. For a standalone test, select Create > Instant cloud flow, choose Manually trigger a flow, and create it.
  2. Add a Compose action from Data Operation, after the action or trigger that supplies your date.
  3. Identify the timestamp you want to format. It might be a SharePoint Created field, an action’s date output, or the current time returned by utcNow().

Before entering a literal timestamp as the first argument, use the ISO 8601 shape yyyy-MM-ddTHH:mm:ssZ, the documented manual-input format for Microsoft Power Automate. For example:

2009-06-15T13:45:30Z

Here, T separates the date from the time, and Z means UTC. Do not append Z to a local clock time unless that time actually represents UTC.

Choose an output pattern using this table; the examples use the timestamp above and English formatting.

Display Needed Format Pattern Example Output
Year-first numeric date yyyy-MM-dd 2009-06-15
US month-first date MM/dd/yyyy 06/15/2009
Day-first date and AM/PM time dd/MM/yyyy hh:mm tt 15/06/2009 01:45 PM
Time only, using a 24-hour clock HH:mm 13:45

Step 2: Enter the Formatting Expression

  1. Select the Inputs field in Compose.
  2. Open its expression editor, shown as fx or Expression, depending on the designer.
  3. For a day-first date with 12-hour time, enter this template:
formatDateTime('<your-value>', 'dd/MM/yyyy hh:mm tt')

Replace <your-value> with your ISO timestamp, keeping straight single quotes around a literal value.

For dynamic content, replace the entire quoted first argument with the field reference, do not put quotes around the reference. For example, a SharePoint trigger with a Created property can use:

formatDateTime(triggerBody()?['Created'], 'dd/MM/yyyy hh:mm tt')

Use the dynamic-content picker when possible so Power Automate inserts the reference to the correct trigger or action. A field from an earlier action will not necessarily use triggerBody().

Confirm the expression to insert it.

Step 3: Use the Result and Test the Flow

  1. In the destination action, select the Compose action’s Outputs dynamic content. For example, insert it into an email body or a text field.
  2. Save the flow and select Test.
  3. Run it with a valid source date.
  4. Open the completed run and expand Compose. Check both Inputs and Outputs.
  5. Check the destination as well: the email, file name, or field should show the intended date.

Inspecting Compose separately helps distinguish an expression problem from a destination that applies its own display formatting.

Common Date and Time Expressions

The formatDateTime() examples cover date-only output, 12-hour and 24-hour times, and built-in formats. Enter them in Compose > Inputs through the expression editor.

Date-Only and Current Date Outputs

For the current date in day-month-year order, use:

formatDateTime(utcNow(), 'dd-MM-yyyy')

To change an existing year-first date into that order, replace utcNow() with the existing date field. You are changing the output arrangement, not adding or subtracting time.

For the current UTC date and time with a full month name and a 24-hour clock, use:

formatDateTime(utcNow(), 'MMMM dd, yyyy, HH:mm')

This produces a value such as June 15, 2009, 13:45, depending on when the flow runs and the formatting locale.

Save and test the flow, then inspect Compose’s output before using it in another action.

Twelve-Hour and Twenty-Four-Hour Time

When AM/PM time and seconds are required, use the pattern yyyy/MM/dd hh:mm:ss tt:

formatDateTime('2009-06-15T13:45:30Z', 'yyyy/MM/dd hh:mm:ss tt')

Output:

2009/06/15 01:45:30 PM

The hour tokens are different:

  • hh is a zero-padded 12-hour hour.
  • h is a 12-hour hour without a leading zero.
  • HH is a zero-padded 24-hour hour.
  • tt adds the AM/PM designator.

You can combine a 24-hour hour with AM/PM, but the result is redundant. For example, the pattern M/dd/yyyy HH:mm:ss tt produces both:

formatDateTime('2009-06-15T13:45:30Z', 'M/dd/yyyy HH:mm:ss tt')

Output:

6/15/2009 13:45:30 PM

For conventional 24-hour output, use M/dd/yyyy HH:mm:ss instead, without the AM/PM token.

After choosing the clock style, save and test the expression with an afternoon timestamp. This makes an accidental 12-hour versus 24-hour choice easy to spot.

Built-In Short and Long Formats

You do not always need a custom pattern. Single-character standard formats expand to built-in date/time layouts.

Use g for the general date/time pattern with short time:

formatDateTime('2009-06-15T13:45:30Z', 'g', 'en-US')

Output:

6/15/2009 1:45 PM

Use D for the long date pattern:

formatDateTime('2009-06-15T13:45:30Z', 'D', 'en-US')

Output:

Monday, June 15, 2009

These standard patterns are culture-dependent. The explicit locale makes the English-language examples predictable; save and test with the locale your recipients need.

Local Time Zones and Languages

A time zone determines the local clock time. A locale determines language and regional formatting conventions. They solve different problems.

Convert UTC Before Formatting

Power Automate uses UTC by default, and utcNow() returns UTC. Before choosing a conversion, inspect the source timestamp: a connector’s value may already include an offset or may represent another time zone.

Convert the timestamp before removing its time component. A UTC timestamp near midnight can fall on a different calendar date in the destination time zone.

For the current time in US Eastern time, converted and formatted in one expression, use:

convertTimeZone(utcNow(), 'UTC', 'Eastern Standard Time', 'dd/MM/yyyy HH:mm')

Eastern Standard Time is a Windows time-zone identifier.

To use this expression:

  1. Enter it in the expression editor for Compose > Inputs.
  2. Replace the destination identifier if your flow needs a different time zone.
  3. Save and test the flow.
  4. Inspect Compose’s output and use its Outputs value in the destination action.

For an incoming timestamp rather than the current time, replace the first argument and set the source zone to match the actual input. Avoid subtracting a fixed number of hours to imitate a zone that observes daylight saving.

Use the Convert Time Zone Action

If you prefer an action instead of an expression:

  1. Add Convert time zone.
  2. Set Base time to your source timestamp.
  3. Set Source time zone to the zone represented by that timestamp.
  4. Set Destination time zone to the required display zone.
  5. Select the required Format string, or enter a custom pattern if the designer offers that option.
  6. Use the action’s formatted result in the destination.
  7. Save, test, and check the resulting date and time.

To format without changing zones, select the same source and destination zone.

Change the Output Language

Use the locale argument to localize weekday and month names. For a long date in French:

formatDateTime(utcNow(), 'D', 'fr-FR')

This changes the language and long-date layout, not the time zone. If both must change, use a converted timestamp as the first argument.

Save and test, then verify that the output labels and date order match the intended audience.

Fix Blank or Invalid Date Inputs

Before changing the format pattern, inspect the failed action’s raw input in run history. A missing value or an unrecognized date string cannot be fixed by choosing a prettier output pattern.

Handle Blank Date Fields

A missing date can make formatDateTime() fail because it expects a timestamp. For an optional trigger field named DueDate, return an empty string when the field is blank:

if(
  empty(triggerBody()?['DueDate']),
  '',
  formatDateTime(triggerBody()?['DueDate'], 'yyyy-MM-dd')
)

Replace DueDate with the actual property name from your trigger, or insert the appropriate dynamic-content reference.

Save and test with both a populated date and a blank date. The populated value should become a formatted date; the blank value should remain blank rather than fail the flow.

Do not silently replace a missing business date with the current date unless that is the intended behavior.

Parse Localized Date Strings Explicitly

The second argument of formatDateTime() describes the output format, not the input format.

If the source supplies a localized string such as 15/06/2009, parse its known layout first:

formatDateTime(
  parseDateTime('15/06/2009', 'en-GB', 'dd/MM/yyyy'),
  'yyyy-MM-dd'
)

Output:

2009-06-15

The parsing pattern must match the source’s actual arrangement. Do not guess the intended order of an ambiguous slash-form date.

Replace the literal with your source value, save the flow, and test with a date whose day and month are different. Confirm that the parsed result represents the original date before using the expression downstream.

Check the Final Date and Time Output

Use this checklist before putting the flow into regular use:

  • Check month versus minute tokens. MM means a two-digit month; mm means minutes.
  • Check the year token. Use yyyy, not YYYY.
  • Check the source reference. The expression must read the correct trigger or action property.
  • Check the date boundary. For local-time output, test a timestamp close to midnight UTC.
  • Check missing-value behavior. An optional date should produce the intended blank or fallback result.

For SharePoint or another typed date column, use a timestamp format accepted by that connector. Use display formatting where you need a human-readable presentation rather than assuming a localized string will be stored as a date.

Excel can also apply its own cell formatting. Writing a date formula to an Excel cell may produce a date display that needs different cell formatting.

After these checks, run the complete flow against a representative record and confirm the date in the final email, file, or destination column, not just in Compose.

Frequently Asked Questions

How Do I Show a Short Date in Power Automate?

Use the standard d format for a short date based on the specified locale:

formatDateTime(utcNow(), 'd', 'en-US')

For en-US, the layout is month/day/year without a time component. Use en-GB when you want the locale’s day-first short-date layout.

Can I Edit the Time Format Directly in an Email Action?

Yes, Compose is optional, and you can insert a formatting expression directly into an email body or another text-capable action input. In the field’s expression editor, use this for a zero-padded 12-hour time with AM/PM:

formatDateTime(utcNow(), 'hh:mm tt')

Save and test the flow, then inspect the received email; this expression displays UTC unless you supply a converted timestamp.

How Do I Add a Timestamp to a File Name?

For a timestamped file name, use a date/time pattern without filename-prohibited characters such as colons:

concat('Report_', formatDateTime(utcNow(), 'yyyy-MM-dd_HH-mm-ss'), '.csv')

Enter the expression in the destination action’s file-name field, then save and test to confirm that the file is created with the expected name. If multiple files can be created within the same second, append a unique identifier rather than relying on the timestamp alone.