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
• Syntax
• Quick Examples
• Popular Format Codes
• Date Format Codes
• Time 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.
Expression | Output |
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 |
Popular Format Codes
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 Code | Output |
MM/dd/yyyy | 06/03/2024 |
M/d/yyyy | 6/3/2024 |
yyyy-MM-dd | 2024-06-03 |
dd/MM/yyyy | 03/06/2024 |
MMMM d, yyyy | June 3, 2024 |
ddd, MMM d, yyyy | Mon, Jun 3, 2024 |
dddd, MMMM d, yyyy | Monday, June 3, 2024 |
dddd, MMMM d, yyyy hh:mm:ss tt | Monday, June 3, 2024 2:15:45 PM |
MM-yyyy | 06-2024 |
MMMM yyyy | June 2024 |
hh:mm tt | 2:15 PM |
HH:mm | 14:15 |
Date Format Codes
Custom date formats for the Power Automate formatDateTime function can be built by using these format codes.
Format Code | Output |
d | 3 |
dd | 03 |
ddd | Mon |
dddd | Monday |
M | 6 |
MM | 06 |
MMM | Jun |
MMMM | June |
yy | 24 |
yyyy | 2024 |
Time Format Codes
Custom time formats for the Power Automate formatDateTime function can be created using these format codes.
Format Code | Output |
h | 2 |
hh | 02 |
HH | 14 |
mm | 15 |
ss | 45 |
tt | PM |
Did You Enjoy This Article? 😺
Subscribe to get new Power Apps & Power Automate articles sent to your inbox each week for FREE
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.
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.
Kurt,
Thank you for the note. I have made a quick edit to my article 🙂
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
Adi,
I appreciate the comments. The corrections have been made and you will see them reflected on the site once the cache is cleared.
This one is not quite right:
dddd, MMM d, yyyy
Mon, June 3, 2024
Gracias
Thanks for another great reference article – clipped it to my one note library for future reference.
Great overview of the date/time function!