Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Triggers
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Planner
    • Outlook
    • SharePoint
    • Teams
  • Resources
  • Get help with flow
Menu

How to easily convert any date into ISO date with Power Automate

Posted on March 23, 2022March 23, 2022 by Tom

“I’ve got a date in my local format, but I have to convert it to ISO to save it into SharePoint, what’s the easiest way to do it in Power Automate?”


Whenever you work with dates in Power Automate, you should use them in the ISO format: yyyy-MM-dd. If you use a date in a different format, the flow won’t work. The Filter query won’t return the expected results, the conditions won’t be evaluated correctly…

Yet often you don’t get the date directly in the ISO format. Your date can be in your local format, e.g. dd.MM.yyyy for the Czech Republic. Or it can have the month, date and year in different order, e.g. MM-dd-yyyy, or a different separator. But whatever the format is, if it’s not an ISO date you should convert it.

You can combine multiple expressions…

One way to convert the date is to use the concat(…) and split(…) expressions. Split(…) the date into separate pieces, and reorder them using their index. Then build the new date again with the concat(…) expression. For example:

Date: 01/13/2022
Format: MM/dd/yyyy

concat(split('01/13/2022','/')[2],'-',split('01/13/2022','/')[0],'-',split('01/13/2022','/')[1])

But that’s not the easiest solution.

…or use a single parseDateTime(…) expression instead!

The easiest solution is to use the parseDateTime(…) expression. This expression can take any date and convert it to the ISO date. It expects three parameters: the date to convert, the locale of the date, and the format of the provided date.

parseDateTime(<date>, <dateLocale>, <dateFormat>)

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

For example, to convert a date from the Czech date format to ISO…

parseDateTime('13.01.2022','cs-CZ','dd.MM.yyyy')

… or reorder an English date and replace the separator.

parseDateTime('01/13/2022','en-US','MM/dd/yyyy')
Power Automate convert date ISO

Both of the examples above will give you the date in the ISO format, which you can use in your flow or reformat as needed.

2022-01-13T00:00:00.0000000

Summary

Power Automate gives you (at least) two options how to convert any date to an ISO date. You can do it either step by step with the split(…) expression, index, and the concat(…) expression, or with a single parseDateTime(…) expression. I prefer the latter since I learned about the expression’s existence.


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 *

Do you know what to do, but not how to do it?

Get The Ultimate Power Automate expressions cheat sheet and translate your thoughts into flows with ease!


NEW! Master the HTTP requests to SharePoint with a new cheat sheet!

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.

  • Use Power Automate to forward Outlook events upon registrationJanuary 29, 2023
  • Why the condition is false for the same numbers (Power Automate)January 25, 2023
  • How to forward event invitation to other calendar (Power Automate)January 22, 2023
  • Run ‘For selected item’ flow from non-default environment (Power Automate)January 18, 2023
  • Hide button in SharePoint list after Power Automate flow startedJanuary 15, 2023

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2023 Let's POWER Automate | Theme by SuperbThemes