Skip to content

Power Automate formatDateTime: Format Codes and Examples

Power Automate formatDateTime: format codes in one table, plus date only, AM/PM, 24-hour, ISO 8601, and time zone examples.

Citizen Development Academy Updated First published 9 min read

The formatDateTime function is how you control date and time output in Power Automate cloud flows (desktop flows use different actions). You hand it a timestamp and a format string, and it returns the date exactly the way you need it: date only, AM/PM, 24-hour time, ISO 8601, day of the week, or any custom pattern.

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

That returns the current UTC date with no time part, for example 2026-06-11.

This guide is the working reference. It covers the format-code table, the steps in the current flow designer, time zone conversion, parsing strings into dates, and the errors that actually trip people up.

How do you use formatDateTime in Power Automate?

You call formatDateTime in any expression field with a timestamp and a format string, and it returns the formatted text. It takes three arguments: the timestamp to format, an optional format pattern, and an optional locale. The syntax:

formatDateTime(timestamp, format?, locale?)
  • timestamp is the date and time value to format. A manually entered value is expected in ISO 8601 form, like 2026-06-11T13:45:30Z. Dynamic content from a trigger or action works directly.
  • format is optional: either a single standard specifier like 'D' or 'g', or a custom pattern like 'MM/dd/yyyy'. Omitting it gives the round-trip o pattern.
  • locale is optional. It defaults to en-us. Pass a culture code such as 'de-DE' to get month and day names in that language.

Full parameter reference: the formatDateTime entry in the workflow functions reference on Microsoft Learn.

Common formatDateTime examples

formatDateTime quick reference card: the six expressions you will actually use, with outputs for utcNow = 2026-06-11T13:45:30Z

Each of these drops into a Compose action, a Set variable action, or directly into any field that accepts expressions.

Date only, no time

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

Returns 2026-06-11. For US-style output use 'MM/dd/yyyy'.

MM/dd/yyyy and dd-MM-yyyy date formats

formatDateTime(variables('currentDate'), 'MM/dd/yyyy')

Returns 06/11/2026. Swap the pattern to 'dd-MM-yyyy' for day-first output, as in 11-06-2026. Here currentDate is a String variable initialized with utcNow(), as set up in the designer steps below.

24-hour time

formatDateTime(utcNow(), 'HH:mm')

Returns 13:45 style output. Capital HH is the 24-hour clock.

AM/PM time

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

Returns 01:45 PM style output. Lowercase hh plus tt is the 12-hour clock with the designator.

ISO 8601

formatDateTime(utcNow(), 'yyyy-MM-ddTHH:mm:ssZ')

This is the interchange format other systems and connectors expect. One caution: the trailing Z in that pattern is a literal character, not a specifier, so it is only truthful when the input really is UTC, like utcNow(). Never reuse this pattern on a value that went through convertTimeZone. For converted values, use the K specifier or omit the format string for the round-trip o default (yyyy-MM-ddTHH:mm:ss.fffffffK): K writes the value’s real time zone information when it has any, and writes nothing, rather than a false Z, when it has none.

Date as a number (yyyyMMdd)

formatDateTime(utcNow(), 'yyyyMMdd')

Returns 20260611. Useful for sortable file names and document IDs, for example when you populate a Word template.

Day of the week or month name

formatDateTime(utcNow(), 'dddd')        // Thursday
formatDateTime(utcNow(), 'MMMM yyyy')   // June 2026

Month and day names in another language

The third parameter sets the locale:

formatDateTime(utcNow(), 'D', 'de-DE')

That returns the long date pattern with German day and month names. The default locale is en-us; an invalid locale value generates an error.

formatDateTime formats: the reference table

Power Automate uses the .NET custom date and time format specifiers. The examples below use the reference timestamp 2009-06-15T13:45:30 from that Microsoft page, so you can check every row against the source.

SpecifierMeaningExample output
dDay of month, no leading zero (1-31); alone, write %d15
ddDay of month, two digits (01-31)15
dddAbbreviated day nameMon
ddddFull day nameMonday
f / ff / fffTenths / hundredths / milliseconds of a second6 / 61 / 617
hHour, 12-hour clock, no leading zero1
hhHour, 12-hour clock, two digits01
HHour, 24-hour clock, no leading zero13
HHHour, 24-hour clock, two digits13
KTime zone information (offset, or Z for UTC)-07:00
mMinute, no leading zero45
mmMinute, two digits45
MMonth number, no leading zero (1-12)6
MMMonth number, two digits (01-12)06
MMMAbbreviated month nameJun
MMMMFull month nameJune
sSecond, no leading zero30
ssSecond, two digits30
tFirst character of AM/PMP
ttFull AM/PM designatorPM
yyTwo-digit year09
yyyyFour-digit year2009
z / zzHours offset from UTC-7 / -07
zzzHours and minutes offset from UTC-07:00
:Time separator (culture-specific):
/Date separator (culture-specific)/
\Escape character: h \h renders 1 h1 h

Notes on the example column:

  • The fractional-second rows use the Microsoft page’s extended variant of the reference timestamp (it carries .6170000).
  • The K and z rows use the page’s Pacific-offset variant. K writes the value’s actual time zone information: an offset when it has one, Z for UTC, and nothing at all when the value has none.
  • The table covers the specifiers flows actually use; the exotic remainder (era specifiers, ffff and longer, the F series, and the single-letter standard format strings) lives in the two .NET pages linked above.

Two specifier rules worth knowing before they cost you a failed run:

  • Case matters. MM is month, mm is minute. HH is 24-hour, hh is 12-hour. The format specifiers are case-sensitive, so a wrong case gives you a different value, not an error.
  • Single characters need a prefix. To use one custom specifier alone, write %h, not h. A bare single character is read as a standard format string and can throw an error if it is not one.

The two standard single-character formats you will use most, straight from the Microsoft examples:

formatDateTime('2009-06-15T13:45:30', 'g')   // 6/15/2009 1:45 PM
formatDateTime('2009-06-15T13:45:30', 'D')   // Monday, June 15, 2009

How to use formatDateTime in the new designer

These steps follow Microsoft’s current date and time values guide. In the new designer the expression editor opens from the fx button on an input field; in the classic designer it is the Expression tab of the dynamic content panel. The expression itself is identical in both.

  1. In your flow, select the input field where the formatted date should go.
  2. Open the expression editor (the fx button, or Add dynamic content then the Expression tab).
  3. Type formatDateTime(), or find it under the Date and time function group.
  4. Provide the timestamp. Manual values go in single quotes; dynamic content does not.
  5. Provide the format string in single quotes.
  6. Select OK (or Add) to insert the expression.

A complete expression with dynamic content from a trigger looks like this:

formatDateTime(triggerBody()?['date'], 'MM/dd/yyyy')

If you store the date in a variable first, the pattern is the same. Initialize a String variable with utcNow(), then format it where you need it:

formatDateTime(variables('currentDate'), 'MM/dd/yyyy')

The Compose action is the usual home for these expressions when you want to see the formatted result in the run history before wiring it into an email or a SharePoint column. If you are new to expressions in general, start with the Power Automate functions overview and the guide to working with variables.

Time zones: utcNow returns UTC, not your local time

Power Automate runs on Coordinated Universal Time by default. utcNow() returns UTC, and a flow that emails “today’s date” can be off by a day for users west of UTC if you never convert it.

Pair formatDateTime with convertTimeZone, as in Microsoft’s own example:

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

That returns the current time adjusted to US Eastern time. The time zone names are Windows time zone IDs, not IANA names like America/New_York. There are also convertFromUtc and convertToUtc functions when one side of the conversion is always UTC.

UTC to local time in Power Automate in three steps: utcNow, convertTimeZone, formatDateTime

Date math: adding and subtracting time

A correction to the earlier version of this guide: there is no subDays function in Power Automate. The documented date and time functions for date arithmetic are:

FunctionWhat it doesReturns
addDays(timestamp, days)Adds days; negative numbers subtractISO 8601 timestamp string
addHours / addMinutes / addSecondsSame, for smaller unitsISO 8601 timestamp string
addToTime / subtractFromTimeAdd or subtract any unit (Day, Week, Month…)ISO 8601 timestamp string
getPastTime / getFutureTimeOffset from the current timeISO 8601 timestamp string
dateDifference(start, end)Difference between two timestampsA timespan like d.hh:mm:ss, NOT a timestamp

The two calls you will write most:

addDays(utcNow(), 7, 'yyyy-MM-dd')     // 7 days from now
addDays(utcNow(), -7, 'yyyy-MM-dd')    // 7 days ago (negative number)

Every function in the table except dateDifference returns an ISO 8601 string that feeds straight into formatDateTime. dateDifference is the exception: its timespan output is not a timestamp, and passing it to formatDateTime throws the same InvalidTemplate error covered in the troubleshooting list below.

Parsing strings into dates with parseDateTime

When the input is a string that only looks like a date, convert it into a real timestamp first. Suppose a system hands you 20260611:

formatDateTime(parseDateTime('20260611', 'en-us', 'yyyyMMdd'), 'yyyy-MM-dd')

parseDateTime reads the string against the locale and pattern you give it and returns a proper timestamp; formatDateTime then renders it however you need. This combination is the standard fix for date columns that arrive as plain text from Excel, CSV imports, or legacy systems.

Troubleshooting formatDateTime errors

The most common failures that show up in run history:

  1. Input is not a valid timestamp. Manually entered values should be ISO 8601 (yyyy-MM-ddTHH:mm:ssZ). A value like 06/11/2026 is not reliable input: it is not ISO 8601, and how it is read depends on locale assumptions. Run ambiguous strings through parseDateTime with an explicit format first. When the input cannot be processed at all, the run fails with an InvalidTemplate error.
  2. Wrong case in the format string. mm where you meant MM silently gives you minutes instead of months. hh without tt gives a 12-hour clock with no way to tell morning from evening.
  3. Null or empty input. A null timestamp throws an error at run time. Guard with a condition or a coalesce() fallback before formatting, especially on optional SharePoint and Dataverse columns. The same discipline applies in OData filters and trigger conditions.
  4. Time zone surprises. The flow ran at 11 PM local, the email says tomorrow’s date. That is UTC. Convert with convertTimeZone before formatting, as shown above.
  5. Single-character custom specifier. formatDateTime(utcNow(), 'h') is interpreted as a standard format string. Write '%h' when you want just the hour.

What formatDateTime does not do

Three boundaries worth knowing before they bite:

  • It returns text, not a date value. When writing to a date-typed SharePoint or Dataverse column, send an ISO value, not a display format. Save 'MM/dd/yyyy' strings for emails and documents.
  • It does not convert time zones. Pair it with convertTimeZone for that.
  • It does not parse loose date strings. Pair it with parseDateTime for that.

Heads-up for Power Automate makers: Microsoft retired Describe it to design it, the option that builds a flow from a plain-language description, on November 30, 2026. “On November 30, 2026, Describe it to design it in Power Automate retires for all customers.” Existing flows aren’t affected. If an AI assistant now writes your expressions, get a second pair of eyes on one flow: the free 30-minute AI app review.

FAQ

What input format does formatDateTime expect?

ISO 8601 for manual strings, like 2026-06-11T13:45:30Z. Dynamic content from triggers and actions already arrives in a compatible form. The default output format, when you pass no format string, is the round-trip o pattern.

How do I get just the date without the time?

formatDateTime(utcNow(), 'yyyy-MM-dd'), or any date-only custom pattern such as 'MM/dd/yyyy'.

How do I show the day of the week?

Use 'dddd' for the full name (Monday) or 'ddd' for the abbreviation (Mon).

Does formatDateTime support languages other than English?

Yes. Pass a locale as the third parameter: formatDateTime(utcNow(), 'D', 'fr-FR'). The default is en-us.

How do I subtract days from a date?

Use addDays() with a negative number, subtractFromTime(), or getPastTime(). There is no subDays function.

How do I change the date format in Power Automate?

Wrap the value in formatDateTime with the pattern you want: formatDateTime(variables('currentDate'), 'MM/dd/yyyy') for US style, 'dd-MM-yyyy' for day-first, 'yyyy-MM-dd' for ISO date-only.

How do I convert UTC to local time in Power Automate?

Convert first, then format: formatDateTime(convertTimeZone(utcNow(), 'UTC', 'Eastern Standard Time'), 'yyyy-MM-dd HH:mm:ss'). Swap in your own Windows time zone ID.

Four habits that prevent formatDateTime errors

formatDateTime is a small function with a long reach: nearly every flow that emails, logs, names files, or writes to a list ends up formatting a date somewhere, including every flow that sends email with a date in the subject line. Four habits prevent almost all the failures above:

  • Feed it ISO 8601 input, and parseDateTime anything that is not.
  • Watch the case of the format string.
  • Guard against null inputs.
  • Convert time zones explicitly before formatting.

For a structured path from expressions like this one to building full production flows, the hands-on option is our 80-hour Power Automate course; the rest of the basics live in What is Power Automate and the substring guide.

Changelog: June 2026, rewritten for the new designer, with the .NET format-specifier table, the locale parameter, and the correct functions for date math (the old version referenced a subDays function that does not exist in Power Automate).

Related articles