Skip to content

Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Problems
  • Triggers
  • Application specific solutions
    • Excel
    • Forms
    • Planner
    • Outlook
    • SharePoint
    • Teams
  • Resources
Menu

How to convert a date into another format with Power Automate flow

Posted on May 4, 2022May 4, 2022 by Tom

“I’ve got a date in the format MMddyyyy and I’d like to convert it into dd/MM/yyyy, how can I do that in Power Automate?”


The standard date format used in Power Automate is ISO 8601. You get dates in this format, use it as a basis when formatting the date, and often also to save them. But not all systems provide the date in the desired format. Since Power Automate can process inputs from various sources, the date format can vary a lot. You might receive attachments with timestamp as MMddyyyy, while the users expect that the date will be dd/MM/yyyy. How do you convert the date? Would you try to do some combination of many expressions to split the date and put it back together? Or do you prefer a simple solution with just 2 expressions?

Convert the date into ISO date

Conversion of a custom formatted date into another custom formatted date will take two steps. Firstly, convert the custom date into an ISO date. Secondly, take the ISO date and convert it into the desired format.

The easiest way to convert any date into an ISO date is to use the parseDateTime(…) expression. Let’s take the MMddyyyy date 05212022 as an example:

parseDateTime('05212022', 'en-US', 'MMddyyyy')

…and convert the date into an ISO formatted date.

2022-05-21T00:00:00.0000000

Convert the ISO date into different format

The ISO date itself is not pretty enough to show it to the users, but it’s the standard format for a flow. As such you can use the formatDateTime(…) expression to format it. The expression below:

formatDateTime('2022-05-21T00:00:00.0000000', 'dd/MM/yyyy')

…will format the date as:

21/05/2022

Combine the expressions

Now you can do it all in a single step by combining the two expressions.

formatDateTime(parseDateTime(<theDate>, <locale>, <sourceFormat>), <targetFormat>)

Note: <…> are placeholders, replace them including the < and >.

Following with the example from above:

formatDateTime(parseDateTime('05212022', 'en-US', 'MMddyyyy'), 'dd/MM/yyyy')
Power Automate convert date format

Summary

If you need to convert a date into another format in your Power Automate flow, you should consider using a middle step. Not trying to “brute force” the conversion, but converting it into another data format that’s easier to work with. In this case it was the conversion into ISO date that made the formatting much simpler, in other situations it can be splitting a string into an array to skip some parts of it.


Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

NOW AVAILABLE:

The Ultimate Power Automate expressions cheat sheet
Spend your time thinking about what the flow should do, not how to do it!

Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Hello and welcome!

My name is Tom and I'm a business process automation consultant and Microsoft MVP living in the Czech Republic. I’ve been working with Microsoft technologies for almost 10 years, currently using mainly Power Automate, SharePoint, Teams, and the other M365 tools.

I believe that everyone can automate part of their work with the Power Automate platform. You can achieve a lot by "clicking" the flows in the designer, but you can achieve much more if you add a bit of coding knowledge. And that's what this blog is about.

To make the step from no-code Power Automate flows to low-code flows: using basic coding knowledge to build more complex yet more efficient flows to automate more of your daily tasks.

  • How to create a new SharePoint list column with Power Automate flowMay 22, 2022
  • How to combine expressions in your Power Automate flowsMay 18, 2022
  • Import Planner tasks with checklists into various buckets (Power Automate)May 15, 2022
  • How to get notified when Planner task was reassigned (Power Automate)May 11, 2022
  • How to extract value from XML using Power Automate flowMay 8, 2022

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

© 2022 Let's POWER Automate | Powered by Superbs Personal Blog theme