Power Automate FormatDateTime Function Examples

Power Automate FormatDateTime Function Examples

The Power Automate formatDateTime function is used to convert a date & time value into a formatted text string. I will explain how to use the formateDateTime function and share several popular date & time format codes to help you quickly get the result you need.

Table of Contents
• SyntaxQuick ExamplesPopular Format CodesDate Format CodesTime Format Codes




Syntax

formatDateTime(Timestamp, Format, Locale)
  • Timestamp – Required. The datetime value to format
  • Format – Optional. The format code which describes the desired output
  • Locale – Optional. The langauge and region in the format ‘en-us’




Quick Examples

Here are some examples of how to use the Power Automate formatDateTime function.

ExpressionOutput
formatDateTime(utcNow(), ‘MM/dd/yyyy’)06/03/2024
formatDateTime(utcNow(), ‘MMMM d, yyyy’)June 3, 2024
formatDateTime(utcNow(), ‘dddd, MMMM d, yyyy hh:mm:ss tt’)Monday, June 3, 2024 2:15:45 PM
formatDateTime(utcNow(), ‘dddd, MMMM d, yyyy hh:mm:ss tt’, ‘fr-fr’)Lundi, Juin 3, 2024 2:15:45 PM

The format argument to the Power Automate formatDateTime function is used to specify the date & time format. Copy and paste these popular format codes into your formatDateTime function to get the desired result.

Format CodeOutput
MM/dd/yyyy06/03/2024
M/d/yyyy6/3/2024
yyyy-MM-dd2024-06-03
dd/MM/yyyy03/06/2024
MMMM d, yyyyJune 3, 2024
ddd, MMM d, yyyyMon, Jun 3, 2024
dddd, MMMM d, yyyyMonday, June 3, 2024
dddd, MMMM d, yyyy hh:mm:ss ttMonday, June 3, 2024 2:15:45 PM
MM-yyyy06-2024
MMMM yyyyJune 2024
hh:mm tt2:15 PM
HH:mm14:15




Date Format Codes

Custom date formats for the Power Automate formatDateTime function can be built by using these format codes.

Format CodeOutput
d3
dd03
dddMon
ddddMonday
M6
MM06
MMMJun
MMMMJune
yy24
yyyy2024




Time Format Codes

Custom time formats for the Power Automate formatDateTime function can be created using these format codes.

Format CodeOutput
h2
hh02
HH14
mm15
ss45
ttPM




Questions?

If you have any questions or feedback about Power Automate FormatDateTime Function Examples please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion.

Matthew Devaney

Subscribe
Notify of
guest

8 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Kurt Henderson
Kurt Henderson
2 months ago

Another great reference article. Thanks Matthew. Note your have an incorrect link for the “popular date & time format codes” in the first paragraph of the email.

Adi
Adi
2 months ago

Hi Matthew, in Date Format Codes, MM would be 06 instead of 6 (you already have an example of it above, so most probably a typo). No need to publish the comment, just be aware of it and amend

Matt Wright
Matt Wright
2 months ago

This one is not quite right:

dddd, MMM d, yyyy
Mon, June 3, 2024

Roberto Carlos Herrera
Roberto Carlos Herrera
2 months ago

Gracias

Andrew Perkin
Andrew Perkin
2 months ago

Thanks for another great reference article – clipped it to my one note library for future reference.

Fran
Fran
1 month ago

Great overview of the date/time function!