web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Convert Date as string...
Power Automate
Unanswered

Convert Date as string to Date for Sharepoint list

(0) ShareShare
ReportReport
Posted on by 295

Hello,

I have read quite a few posts with resolutions about converting a value from a string to a date.  None of the solutions have worked for my situation so I am not sure what is so different.

I am getting the data from a CSV, parsing it into JSON, then either creating or updating an item in a sharepoint list.

The problem only occurs when the date is starting with a number greater than 12.  e.g. 13/01/2021 (dd/mm/yyyy format).

The SharePoint site is set to Time zone (UTS+12:00) Auckland, Wellington.

When I use the date as a string I get the error message, String was not recognized as a valid DateTime

I have tried using the expression  formatDateTime(stringDate, 'dd/MM/yyyy') - I get an error to say it must be in ISO 8601 format.

I then tried using the expression formatDateTime(stringDate, 'yyyy/MM/dd') - I get an error to say it must be in ISO 8601 format.

I have tried splitting up the string into individual parts - Day, Month, Year, then joining them back together and formatting them as dd/MM/yyyy and I get the same error as above. 

formatDateTime(concate(split(stringDate,'\')[2],'/',split(stringDate,'/')[1],'/',split(stringDate,'/')[0],'dd/MM/yyyy') 

If I don't wrap it in the formatDateTime() expression I get an error to say - String was not recognized as a valid DateTime.  So there was no benefit in splitting it apart.

 

There must be away of making this work that I am not understanding.  Can anyone tell me?

PAutomate-formatDate.JPG

 
Categories:
I have the same question (0)
  • Verified answer
    tom_riha Profile Picture
    10,185 Most Valuable Professional on at

    Hello @Rosie ,

    I just tried the expression with reordering the individual parts and it works fine in my flow. Did you try to build only the reordered string, without using the formatDateTime(...) expression, to see what value it creates?

    e.g.
    concat(split('13/01/2021','/')[2],'/',split('13/01/2021','/')[1],'/',split('13/01/2021','/')[0])

    And is it a date only value, without time? If it had time then the split part for year would probably include also the time string.

  • Rosie Profile Picture
    295 on at

    Hi @tom_riha ,

    Thanks so much that worked! Could have sworn I tried that but obviously not.

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard