The DateTime String must match ISO 8601 format error in Power Automate

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:

the datetime string must match iso 8601 format power automate

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:

The DateTime String must match ISO 8601 format in Power Automate

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
power automate the datetime string must match iso 8601 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.

See also  How to Create an HTML Table from Excel in Power Automate

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],'/')
the datetime string must match iso 8601 format power automate

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])
Datetime string must match ISO 8601

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')
Datetime string must match ISO 8601in Power Automate

Save and run the flow; once the flow runs successfully, we can see the expected result, which converts the string date in Power Automate.

The datetime string must match ISO8601 format 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.

See also  How to Format Number without Decimal in Power Automate?

You may also like:

>