When working with date and time values (ie. DateTime values) in flow, they may look like:

  • 2019-12-06T22:47:23.0798367Z

  • 2009-06-15T13:45:30Z

You may format these values to look like:

  • 6/15/2009 1:45 PM

  • Monday, June 15, 2009

This is done through the use of Date and Time Format Strings passed to the formatDateTime() function.

Format Strings

A standard format string is a single character (ex. 'd', 'g', 'G', this is case-sensitive) that corresponds to a specific pattern.

For example the format string 'g' corresponds to the General date/time pattern (short time):

  • formatDateTime

    ('2009-06-15T13:45:30', 'g') -> 6/15/2009 1:45 PM


A custom format string is any string with more than one character (ex. 'M/dd/yyyy h:mm tt') that can control the visibility, positioning, precision of the month, day, hour, second etc. of the DateTime value.

For example the format string 'M/dd/yyyy h:mm tt' represents the same pattern as the standard format string 'g' as described above:

  • formatDateTime

    ('2009-06-15T13:45:30', 'M/dd/yyyy h:mm tt') -> 6/15/2009 1:45 PM


See belowfor more information about available standard format patterns and how to construct a custom format string.

Example Steps

  1. Select the input field where you want the formatted DateTime value

  2. Go to the expression editor ('Add dynamic content' -> click on 'Expression' tab)

  3. Type formatDateTime() (or look under 'Date and time' functions)

  4. Provide the value (can be dynamic content) to be formatted (surrounded by single quotes)

  5. Provide the format string (surrounded by single quotes)

  6. The full expression should look like:
    formatDateTime('<your-value>', 'dd/MM/yyyy hh:mm tt')

  7. Click 'Ok'


Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Insiders

Was this information helpful?

What affected your experience?

Thank you for your feedback!