Power automate format string?

How-to basics · Updated November 23, 2026

The direct answer: in Power Automate, you format a string by using the formatNumber() expression for numbers and formatDateTime() for dates/times, both of which take a value and a .NET format string. For example, formatNumber(1234.5, 'C2') returns $1,234.50, and formatDateTime(utcNow(), 'yyyy-MM-dd') returns the current date in ISO format.

What “format string” means in Power Automate

Power Automate does not have a single “format string” function. Instead, it provides two expression functions that accept a format string as a parameter: formatNumber() and formatDateTime(). These are part of the expression language used in actions like “Compose,” “Condition,” and “Apply to each.” The format strings themselves follow the .NET Framework conventions, which means they use placeholders like 0 for digits, # for optional digits, and standard date/time format specifiers like yyyy for a four-digit year.

You can also format a string using the concat() function to join text and formatted values, but that is not the same as applying a format mask. The key distinction is that formatNumber() and formatDateTime() transform the value’s representation, while concat() only combines strings.

How to use formatNumber for numbers

The syntax is formatNumber(number, format [, locale]). The first parameter is the numeric value (which can be a variable, a dynamic content, or a literal number). The second parameter is the format string. The optional third parameter is a locale code (like 'en-US' or 'de-DE') that affects grouping separators and decimal symbols.

Common format strings for numbers:

  • '0' – Rounds to whole number: formatNumber(12.6, '0') returns 13.
  • '0.00' – Always shows two decimals: formatNumber(12.5, '0.00') returns 12.50.
  • '#,##0.00' – Adds thousands separators: formatNumber(12345.678, '#,##0.00') returns 12,345.68.
  • 'C' – Currency: formatNumber(25, 'C') returns $25.00 in en-US.
  • 'P0' – Percentage with zero decimals: formatNumber(0.125, 'P0') returns 13%.

If you omit the locale, Power Automate uses the default locale of the environment (usually en-US). To force a specific format, provide the locale: formatNumber(1234.5, 'C2', 'fr-FR') returns 1 234,50 €.

How to use formatDateTime for dates and times

The syntax is formatDateTime(timestamp, format [, locale]). The timestamp must be a string in ISO 8601 format (e.g., '2025-03-15T10:30:00Z') or a variable containing such a string. The format string uses .NET date/time format specifiers.

Common format strings for dates:

  • 'yyyy-MM-dd' – ISO date: formatDateTime('2025-03-15T10:30:00Z', 'yyyy-MM-dd') returns 2025-03-15.
  • 'MM/dd/yyyy' – US style: returns 03/15/2025.
  • 'dddd, MMMM d, yyyy' – Full name: returns Saturday, March 15, 2025.
  • 'HH:mm' – 24-hour time: returns 10:30.
  • 'hh:mm tt' – 12-hour time with AM/PM: returns 10:30 AM.

Note that formatDateTime does not convert time zones; it only changes the display format. If you need to convert from UTC to a specific time zone, use the convertTimeZone() function first, then format the result. For example: formatDateTime(convertTimeZone(utcNow(), 'UTC', 'Eastern Standard Time'), 'yyyy-MM-dd HH:mm').

How to choose the right format string

Choosing a format string depends on the output you need. For data exchange (like sending to a database or API), use 'yyyy-MM-dd' for dates and '0.00' for numbers to avoid locale surprises. For human-readable reports, use longer formats like 'MMMM d, yyyy' or currency with 'C2'.

If you are not sure what a format string produces, test it in a “Compose” action and run the flow to see the output. You can also use the expression editor’s “Dynamic content” tab to insert functions, but you must type the format string manually.

Common problems and mistakes

One frequent error is using a format string that is not valid for the type. For example, applying a date format to a number returns an error. Another issue is using single quotes incorrectly – in Power Automate expressions, strings are enclosed in single quotes, not double quotes. Also, the second parameter must be a string literal or a string variable; you cannot pass a number directly.

Another common mistake is assuming that formatDateTime changes the time zone. It does not. If you see an unexpected hour, check whether the input timestamp is in UTC and convert it first. Also, remember that formatNumber rounds, not truncates. formatNumber(2.5, '0') returns 3 (banker’s rounding may apply in some cases, but .NET uses round-half-to-even by default, so 2.5 becomes 2 and 3.5 becomes 4).

Alternatives and related functions

If you need to build a string from multiple parts, use concat() or the string() function to convert a value to its default string representation. For example, concat('Order #', string(variables('orderId'))) joins a prefix with a number. If you need to extract a substring from a formatted string, use substring() after formatting.

For more complex transformations, you can use replace() to swap characters, or trim() to remove spaces. However, for numbers and dates, formatNumber and formatDateTime are the only built-in formatting functions. In Power Automate, there is no direct equivalent to Excel’s TEXT() function, but these two cover the same needs.

Frequently Asked Questions

Can I format a string that is already text?
No, formatNumber and formatDateTime require numeric or date/time values. For text, you can use concat(), substring(), or replace() to manipulate it.

Why does my formatted date show the wrong day?
Most likely because the input timestamp is in UTC and you didn’t convert to your local time zone. Use convertTimeZone() before formatting.

How do I format a number as a percentage?
Use formatNumber(0.125, 'P1'). The value must be a decimal (e.g., 0.125 for 12.5%). The format string multiplies by 100 and adds the % symbol.

What is the difference between ‘0’ and ‘#’ in a number format?
A 0 always displays a digit, even if it’s zero. A # only displays a digit if it’s significant. For example, '0.00' shows 12.50, while '#.##' shows 12.5.

Can I use format strings in a condition?
Yes, you can use the formatted value as part of a condition, but it’s often better to compare the raw value. For example, to check if a date is in 2025, compare formatDateTime(utcNow(), 'yyyy') to '2025'.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.