All articles

Power Automate Formatting Cheat Sheet

formatDateTime, convertTimeZone, formatNumber — these expressions handle 90% of formatting needs in Power Automate. Here's the syntax, common format strings, and fixes for the errors that come up.

· 9 min read

Every flow eventually needs to format a date for an email subject, convert a UTC timestamp to the user’s time zone, or turn a number into a currency string. Power Automate has expressions for all of this, but the syntax isn’t intuitive and the error messages aren’t helpful.

Here’s a reference for the formatting expressions you’ll actually use.

Formatting Dates with formatDateTime

The basic syntax:

formatDateTime(triggerOutputs()?['body/createdon'], 'yyyy-MM-dd')

This outputs something like 2026-03-28.

Common Format Strings

Format StringOutput ExampleNotes
yyyy-MM-dd2026-03-28ISO date, good for file names
MM/dd/yyyy03/28/2026US date format
dd/MM/yyyy28/03/2026European format
MMMM dd, yyyyMarch 28, 2026Human-readable
MMM ddMar 28Short month
yyyy-MM-dd HH:mm2026-03-28 14:30Date and 24-hour time
hh:mm tt02:30 PM12-hour time with AM/PM
ddddSaturdayDay of week name
HH:mm:ss14:30:00Time only (24-hour)

Important: MM is month, mm is minutes. Mix these up and you’ll get wrong results with no error message.

Format Characters Quick Reference

  • yyyy — 4-digit year
  • yy — 2-digit year
  • MM — 2-digit month (01-12)
  • MMM — Abbreviated month (Jan, Feb)
  • MMMM — Full month name (January, February)
  • dd — 2-digit day (01-31)
  • dddd — Full day name (Monday, Tuesday)
  • HH — 24-hour hour (00-23)
  • hh — 12-hour hour (01-12)
  • mm — Minutes (00-59)
  • ss — Seconds (00-59)
  • tt — AM/PM

Converting Time Zones

Dataverse stores all dates in UTC. If your flow sends an email saying “Your meeting is at 2026-03-28T14:00:00Z,” the user gets confused because that’s not their local time.

Use convertTimeZone:

convertTimeZone(
    triggerOutputs()?['body/scheduledstart'],
    'UTC',
    'Eastern Standard Time'
)

To format the result at the same time, wrap it in formatDateTime:

formatDateTime(
    convertTimeZone(
        triggerOutputs()?['body/scheduledstart'],
        'UTC',
        'Eastern Standard Time'
    ),
    'MMMM dd, yyyy hh:mm tt'
)

Output: March 28, 2026 10:00 AM

Time Zone Names

Use the Windows time zone IDs. Common ones:

Time ZoneID
US EasternEastern Standard Time
US CentralCentral Standard Time
US PacificPacific Standard Time
UKGMT Standard Time
Central EuropeCentral European Standard Time
IndiaIndia Standard Time
Australia EasternAUS Eastern Standard Time

These IDs handle daylight saving time automatically — Eastern Standard Time correctly returns EDT during summer months.

Date Math: Adding and Subtracting

Add Days

addDays(utcNow(), 7)

Returns the date 7 days from now. Use negative numbers to go backward:

addDays(utcNow(), -30)

Add Hours, Minutes

addHours(utcNow(), 3)
addMinutes(utcNow(), 45)

Subtract Time with subtractFromTime

subtractFromTime(utcNow(), 2, 'Hour')
subtractFromTime(utcNow(), 30, 'Day')

Add Time with addToTime

addToTime(utcNow(), 1, 'Month')
addToTime(utcNow(), 1, 'Year')

Getting Start and End of Day

Start of today:

startOfDay(utcNow())

Start of the month:

startOfMonth(utcNow())

Formatting Numbers

formatNumber for Currency and Decimals

formatNumber(12345.6, 'C', 'en-US')

Output: $12,345.60

formatNumber(12345.6, 'C', 'de-DE')

Output: 12.345,60 €

Fixed Decimal Places

formatNumber(42.5, 'N2')

Output: 42.50

formatNumber(42.5, 'N0')

Output: 43 (rounded, no decimals)

Common Format Specifiers

SpecifierExample InputOutputMeaning
C1234.5$1,234.50Currency (locale-dependent)
N21234.51,234.50Number with 2 decimal places
N01234.51,235Number with no decimals
P0.8585.00%Percentage
P00.8585%Percentage, no decimals

Padding Numbers with Leading Zeros

To turn 5 into 005:

formatNumber(5, 'D3')

Output: 005

This is useful for invoice numbers, ticket IDs, and similar sequential values.

Parsing Strings into Dates

If you receive a date as a string from an external system:

formatDateTime('2026-03-28', 'MMMM dd, yyyy')

Power Automate can usually parse ISO format strings directly. For non-standard formats, you may need to extract parts with substring() and rebuild the date.

Common Mistakes and How to Fix Them

”InvalidTemplate” or “Unable to process template language expressions”

This almost always means your expression has a syntax error. Common causes:

  • Missing closing parenthesis
  • Using smart quotes (curly quotes) instead of straight quotes — don’t compose expressions in Word or Outlook
  • A null value being passed to formatDateTime — wrap with a condition or use coalesce() first

Date Shows Wrong Time (Off by Several Hours)

You’re displaying a UTC timestamp without converting it. All Dataverse dates are UTC. Always use convertTimeZone() before displaying times to users.

MM vs mm Confusion

formatDateTime(utcNow(), 'yyyy-mm-dd') gives you 2026-30-28 (minutes instead of months). Use uppercase MM for months, lowercase mm for minutes.

formatNumber Returns an Error on Text Values

formatNumber requires an actual number, not a string that looks like a number. If your value comes from a text field or parsed JSON, convert it first:

formatNumber(float(body('Parse_JSON')?['amount']), 'C', 'en-US')

addDays Returns a Timestamp, Not Just a Date

addDays(utcNow(), 7) returns a full timestamp like 2026-04-04T14:30:00.0000000Z. If you just want the date portion, wrap it:

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

Locale-Specific Currency Formatting

formatNumber(1234, 'C') without a locale argument uses the flow’s default locale, which might not match what your users expect. Always pass the locale explicitly:

formatNumber(1234, 'C', 'en-US')    // $1,234.00
formatNumber(1234, 'C', 'en-GB')    // £1,234.00
Share this article LinkedIn X / Twitter

Related articles

Your First Approval Flow

A step-by-step guide to building approval flows in Power Automate, including connector provisioning, approval types, custom email content, and handling the response — plus the errors that block most first-time setups.

· 9 min read