cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jonnyphoto
Frequent Visitor

Formatedatetime ISO error

Hey,

 

I am having an issue with a date format, the captured date is parsed into . variable and has the format dd/mm/yyyy and i want to convert it to yyyy-mm-dd

 

I am using this expression - formatDateTime(variables('Hire_date'),'yyyy-MM-dd')

 

But thew compose action fails with 

 

Unable to process template language expressions in action 'Compose' inputs at line '1' and column '49609': 'In function 'formatDateTime', the value provided for date time string '23/11/2019' was not valid. The datetime string must match ISO 8601 format.'

 

I'm struggling to understand what I am doing wrong in the compose step.

 

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions

@Jonnyphoto 

See my example below and post here if you have additional questions.

ComposeDateTime1.jpg

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

13 REPLIES 13
abm
Super User
Super User

Hi @Jonnyphoto 

 

You need to use convertTimeZone. See this link below.

 

https://powerusers.microsoft.com/t5/General-Power-Automate/Formatting-Date-And-time-in-MS-Flow/m-p/7...

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials
Jonnyphoto
Frequent Visitor

Hi,

 

No I don't think this answers the question.

 

I am trying to change 23/11/2019 to 2019-11-23

 

Thanks.

My compose step has this expression

 

convertTimeZone(variables('Hire_date'),'UTC','W. Europe Standard Time','yyyy-MM-dd')
 
but that fails with the same error

@Jonnyphoto 

See my example below and post here if you have additional questions.

ComposeDateTime1.jpg

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Anonymous
Not applicable

Looking good

Hi @ScottShearer ,

 

I've tried to follow your expressions, but for the 'New Date' box, I've encountered this error. 

 

Query Flow.PNG

 

May I know what I did wrong? I followed your steps exactly, just that the initial input I put my own data.

 

Input for Flow.PNG

 

Your soonest response is highly appreciated and thank you so much for the help.

Regards,

Nawi

 
 

@M_Asnawi 

Please add the expressions that you used as comments in the compose action and post a screen shot.

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

@ScottShearer 

 

Kindly find the comments below:

 

Query 1.PNGQuery 2.PNG

 

My sample data is as below:

 

Query 3.PNG

 

Thank you so much Scott for replying. I really appreciate it.

Regards,

Nawi

 

kmargerison
Frequent Visitor

Hey @M_Asnawi / @ScottShearer - I am getting the exact same error on the 'New Date' action.  How did this error get solved please? 🙂  Thank you!

MH3
Post Prodigy
Post Prodigy

Hi,
I am getting the exact same error, have you solved it? @M_Asnawi  @kmargerison 

Help @ScottShearer 

M_Asnawi
Frequent Visitor

@kmargerison @MH3

 

I changed the data to ISO Format. There's the DateTime Format at the bottom.

 

Thank you.

 

 DateTime Format.png

Pcsmith
Frequent Visitor

@M_Asnawi @ScottShearer 

I tried that solution but I still get the same error.  Any suggestions would be appreciated.  Thanks!

 

Pcsmith_0-1639349284750.png

 

Pcsmith
Frequent Visitor

I figured it out - the dates in the example were split by a "/", and thus a "/" was used in the split function example, but my dates are in the format of being separated by a dash "-".  So the split function did not split any of the elements of  my date because the formatting was incorrect, leaving me with a 0,0 array that could not be evaluated in the New Date function.

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,249)