Skip to main content
Community site session details

Community site session details

Session Id : maceggMXXaUtWp7heskHZL
Power Automate - Building Flows
Answered

Problem with converting date to formatdate

Like (0) ShareShare
ReportReport
Posted on 6 May 2024 10:29:51 by 113

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:

2.png

 

1.png

 

I try different version: string(), formatdatetime(), parsedate time. Error always is the same.

 

I don't any idea, where are problems.

 
 

 

 

  • Sbsyx Profile Picture
    113 on 28 May 2024 at 07:37:40
    Re: Problem with converting date to formatdate

    Thanks!

  • Verified answer
    Chriddle Profile Picture
    7,932 Super User 2025 Season 2 on 27 May 2024 at 14:09:19
    Re: Problem with converting date to formatdate

    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'
    	)
    )

     

  • Sbsyx Profile Picture
    113 on 27 May 2024 at 08:38:57
    Re: Problem with converting date to formatdate

    Ok, It is results.

    1.png

     

    2.png

    And I try to change data on string. I got feedback (error):

    3.png

     

  • Chriddle Profile Picture
    7,932 Super User 2025 Season 2 on 24 May 2024 at 13:18:14
    Re: Problem with converting date to formatdate

    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.

     

  • Sbsyx Profile Picture
    113 on 24 May 2024 at 12:15:19
    Re: Problem with converting date to formatdate

    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. 

     
     

     

     

  • BhargavPatel Profile Picture
    658 Moderator on 24 May 2024 at 12:05:42
    Re: Problem with converting date to formatdate

    @Sbsyx Have you tried the solution from this post?

  • Sbsyx Profile Picture
    113 on 24 May 2024 at 11:33:55
    Re: Problem with converting date to formatdate

    Still error:

    Sbsyx_0-1716550351188.png

     

  • Chriddle Profile Picture
    7,932 Super User 2025 Season 2 on 24 May 2024 at 09:12:50
    Re: Problem with converting date to formatdate

    An example with the JSON you have provided:

    Chriddle_0-1716541646728.png

    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"
     }
    ]

     

  • Sbsyx Profile Picture
    113 on 24 May 2024 at 07:25:49
    Re: Problem with converting date to formatdate

    Still the same problem. Even the content of the error does not change...

  • Chriddle Profile Picture
    7,932 Super User 2025 Season 2 on 23 May 2024 at 20:15:20
    Re: Problem with converting date to formatdate

    Use function parseDateTime() to conver the date to ISO-8601

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2

Loading complete