Advertisements

Microsoft Flow – Format Dates with formatDateTime

Getting a date

Recently quite a few citizen developer asked me how to format dates in Flow. Quite often people want to send dates in an email, however formatting these dates doesn’t seem to be that easy.

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!

Format the date using formatDateTime

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

using the formatDateTime function

and my date will appear in the European format of day-month-year

 

Date shown in clean format

Advertisements

7 thoughts on “Microsoft Flow – Format Dates with formatDateTime

  1. 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

  2. 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

    1. 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.

Leave a Reply

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

%d bloggers like this: