Hello,
I have strange of problem. I don't understand its.
So... I have data in Parse JSON version. I want to convert date from JSON on formatdatetime 'yyyy-MM-dd'. All data are string formattig, but flow just convert some dates. Others have error:
Unable to process template language expressions in action 'FormatDataTime' inputs at line '0' and column '0': 'In function 'formatDateTime', the value provided for date time string '27-03-2025' was not valid. The datetime string must match ISO 8601 format.'.
Screens:
I try different version: string(), formatdatetime(), parsedate time. Error always is the same.
I don't any idea, where are problems.
Thanks!
Ok, some of your values are empty. This doesn't fit as a parameter for function parseDateTime()
Try this:
if(
empty(item()['Subscription End Date']),
null,
formatDateTime(
parseDateTime(item()['Subscription End Date'], 'es-es', 'dd-MM-yyyy'),
'yyyy-MM-dd'
)
)
Ok, It is results.
And I try to change data on string. I got feedback (error):
This time the date string already has the correct format. Hence no parseDatetime needed.
The error occurs because the parseDatetime format string does not match the entered date format.
Maybe you should show us the exact expressions you use.
Yes and I try add formatting date to list Sharepoint. Still problems. When column is text type it is ok, but when change on date type it is error.
Still error:
An example with the JSON you have provided:
Select
From
body('Parse_JSON')
Map Country
item()[' Country']
Map Subscription Start Date
formatDateTime(
parseDateTime(item()['Subscription Start Date'], 'es-es', 'dd-MM-yyyy'),
'yyyy-MM-dd'
)
Map Subscription End Date
formatDateTime(
parseDateTime(item()['Subscription End Date'], 'es-es', 'dd-MM-yyyy'),
'yyyy-MM-dd'
)
Result
[
{
"Country": " PL",
"Subscription Start Date": "2024-03-28",
"Subscription End Date": "2025-03-27"
},
{
"Country": " PL",
"Subscription Start Date": "2024-03-03",
"Subscription End Date": "2024-04-02"
}
]
Still the same problem. Even the content of the error does not change...
Use function parseDateTime() to conver the date to ISO-8601
Michael E. Gernaey
497
Super User 2025 Season 2
David_MA
436
Super User 2025 Season 2
Riyaz_riz11
244
Super User 2025 Season 2