Power Automate FormatDateTime Expression

Introduction

In Power Automate, the formatDateTime expression is a function that allows you to format a date and time into a specific format. This is especially useful when you need to display or use dates and times in a certain way for your workflows, such as in emails, notifications, or further logic

For example in power automate the expression utcNow() would give us an output:

Year-Month-DayTHour:Minute:Second.FractionalSecondsZ

2025-03-17T09:30:34.0601101Z

Popular Date Formats

Here are some of the most common date formats used:
Input2025-03-17T09:30:00.0000000Z
ExpressionformatDateTime(‘2025-03-17T09:30:00.0000000Z’,’dd/MM/yyyy’)
Output17/03/2025
Input2025-03-17T09:30:00.0000000Z
ExpressionformatDateTime(‘2025-03-17T09:30:00.0000000Z’,’d, MMMM, yyyy’)
Output3, March, 2025
Input2025-03-17T09:30:00.0000000Z
ExpressionformatDateTime(‘2025-03-17T09:30:00.0000000Z’,’dddd, d, MMMM, yyyy’)
OutputMonday 3, March 2025

Popular Time Formats

Here are some of the most common Time formats used:
Input2025-03-17T15:30:00.0000000Z
ExpressionformatDateTime(‘2025-03-17T15:30:00.0000000Z’,’HH:mm’)
Output15:30
Input2025-03-17T15:30:00.0000000Z
ExpressionformatDateTime(‘2025-03-17T15:30:00.0000000Z’,’hh:mm tt’)
Output03:30 PM
Input2025-03-17T15:30:00.0000000Z
ExpressionformatDateTime(‘2025-03-17T15:30:00.0000000Z’,’HH:mm:ss’)
Output15:30:00

More complex Date Formatting

One more common date format but is harder to implement is the ordinal numbers. For example a date that is 16/03/2025 you want to read 16th March 2025

The code below checks common ordinal numbers e.g. 1 would be 1st 2 would be 2nd and adds ‘st‘, ‘nd‘, ‘rd‘ and ‘th‘ depending on the number, it also checks to make sure there is no leading ‘0’ for example ‘03/03/2025‘ should read ‘3rd March 2025‘ not ‘03rd March 2025‘ it then uses ‘concat’ to join the string with the month and year

				
					@{concat(
    formatDateTime(utcNow(), 'dd'),
    if(and(greaterOrEquals(int(formatDateTime(utcNow(), 'dd')), 11), lessOrEquals(int(formatDateTime(utcNow(), 'dd')), 13)), 
        'th', 
        if(equals(mod(int(formatDateTime(utcNow(), 'dd')), 10), 1), 'st', 
        if(equals(mod(int(formatDateTime(utcNow(), 'dd')), 10), 2), 'nd', 
        if(equals(mod(int(formatDateTime(utcNow(), 'dd')), 10), 3), 'rd', 'th')))),
    ' ',
    formatDateTime(utcNow(), 'MMMM yyyy')
)
}
				
			

Like this post? Why not share it!

LinkedIn
WhatsApp
Facebook
Reddit
X
Email

View more blog posts

Power Apps Environments

2 min read

Read this blog

Dataverse Lookup In Power Automate

2 min read

Read this blog

Get Unique Data from SharePoint List

2 min read

Read this blog

Trigger Power Automate Flow From Canvas App

4 min read

Read this blog

Get In Touch

Let’s talk. Send us a message, and we’ll help you explore the best Power Platform solution for your business

We can turn your mondain tasks into effective workflows, saving you and your business time and money