formatDateTime to Format Dates in your flow with Power Automate

Generate a date in your Flow

Recently quite a few citizen developer asked me how to format dates in a flow in Power Automate.

Quite often people want to send dates in an email, however formatting these dates doesn’t seem to be that easy. In this post I will look at formatDateTime to format dates in Power Automate.

An example without formatting the date

In my example I’m just going to take the current date and send it out by email:

Send and email action

This now gives me the following email:

Date in email shown in standard UTC format

OK, that is ugly!

To get a proper date you might be happy with the first part. Or maybe you want to include the time as well but I still have to find the first person who would be happy with that T and Z in the date and time.

formatDateTime flow function in Power Automate

Now I add Flow’s formatDateTime function and a format string ‘dd-MM-yyyy’.

formatDateTime in Power Automate

Using this format and I will see that my date will appear in the European format of day-month-year.

Date shown in clean format

For the full overview of the format strings please have a look at the formatDateTime function documentation

Other uses for the formatDataTime flow function

You can use the formatDateTime flow function to format dates and that is the most common use.

When you want to get for example just the day of the month or if you just want to get the hour of the time you could use the formatDateTime flow function as well.

Other date formatting Power Automate posts

Format your dates in PowerApps

Convert your time faster in Power Apps to all time zones using Power Automate

7 thoughts on “formatDateTime to Format Dates in your flow with Power Automate

  1. commented on November 13, 2018 by Jonas Björkander

    Thanx!

  2. commented on April 24, 2019 by Ivaylo

    Thanks, Pieter!

  3. commented on May 17, 2019 by Simon Hudson

    So simple, when you know how. I went bald trying to get a sensible date format to work when Flow first came out. Bloody stupid US date formats! (UTC, is better, if unfriendly). Thanks Pieter

  4. commented on August 15, 2019 by Sue Wheeler

    Hi, Please can you help me with a date format issue.. I tried your example above and it worked, but when I try to use this “formatdatetime” expression on one of my own date fields it doesn’t work. For example, my date field “DateRequired”
    Can you please show me how this is put together in a string so that it displays in UK date format (i.e. non US format)?
    Many thanks
    Sue

    • Hi Sue,

      You might find that different types of datasources present dates in different ways. I would collect the dates in question in a Compose action and then compare the date formats. Flow will look at the date as a string so that means that the exact text format is important.

  5. commented on October 2, 2019 by Aaron C

    Important note: the ‘MM’ must be capitalized, otherwise you get minutes instead of month!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: