Are you facing the “The DateTime String must match ISO 8601 format” error?
In this Power Automate tutorial, we will see how to fix the DateTime String must match the ISO 8601 format that comes in Power Automate.
Recently, when I was converting the String date value to Date value format, I came across an error that the entered String was not valid. The exact error message, “The DateTime format must match the ISO 8601 format” as highlighted below:
Now in this Power Automate tutorial, we will see how to overcome The DateTime String must match ISO 8601 format Error.
Error: The DateTime String must match ISO 8601 format
Here, I was using the instant cloud flow, in the new step, I have passed the String date value in the compose data operation as shown below:
I wanted to convert this String date value to the Date formatted value in Power Automate. So, I used the below expression in the compose data operation.
formatDateTime(outputs('String_Date_Value'),'yyyy-MMMM-dd')
Where,
- format DateTime – function name
- String_Date_Value – output of the compose data operation
- YYYY-MM-DD – date format
When I ran this flow, I Came across the Error: the value provided for the date time string ’28/09/2023 19:00:00′ was not valid. The DateTime String must match the ISO 8601 format.
Now in the following, I will show how we can overcome this error.
Solution – The DateTime String must match the ISO 8601 format.
First, we should get an idea of why we get this error while converting the String date value to the date format value.
Because the DateTime string must match ISO 8601 format yyyy-MM-dd in Power Automate flow.
In my case, the string value I passed in the compose data operation is not in the ISO 8601 format (yyyy-MM-dd).
- I have overcome this issue, by splitting the date values as date, Month, and Year by using the Split function.
- Later, based on the output of the compose data operation index value, I concat the values in the ISO 8601 format of (yyyy-MM-dd) by using the concat function.
- Finally, using the Format DateTime function I formatted the date values as per my requirement.
Step- 1:(Split Function)
Add a compose data operation from action triggers and pass the below expression:
split(split(outputs('String_Date_Value'),' ')[0],'/')
Step-2:
Add another compose data operation from action triggers and, based on the output of the compose data operation split function index value, concat the values in the ISO 8601 format of (yyyy-MM-dd) by using the concat function.
concat(outputs('Split_Function')[2],'-',outputs('Split_Function')[1],'-',outputs('Split_Function')[0])
Step-3:
Use the Format DateTime function and convert the string to date as required. Based on the output of the concat data operation, which is of ISO 8601 (yyyy-MM-dd) format.
formatDateTime(outputs('Concat_Function'),'yyyy-MMMM-dd')
Save and run the flow; once the flow runs successfully, we can see the expected result, which converts the string date in Power Automate.
This is how I fixed my The DateTime String must match the ISO 8601 format in Power Automate error.
Conclusion
So I hope now you get an idea why we get the DateTime String must match the ISO 8601 format in Power Automate. And how to fix the DateTime String must match the ISO 8601 format in Power Automate flow.
You may also like:
- Format Numbers with Leading Zeros Using Power Automate
- Argument ‘Body’ must be ‘Binary’ – Power Automate Desktop error
- How to Convert Float to Integer in Power Automate?
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com