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

formatDateTime error

I was running into this error:

 

Unable to process template language expressions in action 'Create_Document_Review_Reminder' inputs at line '1' and column '2264': 'In function 'formatDateTime', the value provided for date time string '24/03/2021 14:46:10' was not valid. The datetime string must match ISO 8601 format.'.

 

What is supposed to be the format? The column where this gets created is in a DateTime format of dd/MM/yyyy.

 

This is the expression that I use where Converted _time_to_NZ is the current time converted to NZ timezone.

formatDateTime(body('Converted_time_to_NZ'), 'dd/MM/yyyy')

 

Any ideas?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

Re: formatDateTime error

I finally managed to get it to work.

 

So instead of using 'dd/MM/yyyy', I switched it to 'MM/dd/yyyy' so the expression goes like this:

 

formatDateTime(body('Converted_time_to_NZ'), 'MM/dd/yyyy')

 

It finally worked. And my Review Due Date column still goes to dd/MM/yyyy format since I am using the New Zealand timezone in the site's settings.

 

View solution in original post

8 REPLIES 8
Highlighted
Dual Super User III
Dual Super User III

Re: formatDateTime error

Hi
"Converted _time_to_NZ is the current time converted to NZ timezone"
Which expression/action block did you use to convert utcNow() into NZ timezone?
Thanx!


Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Highlighted
Frequent Visitor

Re: formatDateTime error

 

Here is a screenshot of my flow for the Converted_time_to_NZ. Calculated time is from the Calc_Review_Date_in_International time.

This worked for dates that are 09/03/2020 and 11/03/2020. But it didn't for 24/03/2020. It seemed to be okay if it's MM/dd/yyyy. 

Capture_Flow.PNG

 

Highlighted
Dual Super User III
Dual Super User III

Re: formatDateTime error

Hi!

Can you try with this format instead?

Flow_ConverTimeZone.png

Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Highlighted
Frequent Visitor

Re: formatDateTime error

I tried that but I got the below error instead. I am thinking what other option to use aside from formatDateTime.

 

String was not recognized as a valid DateTime.

Highlighted
Community Support
Community Support

Re: formatDateTime error

Hi @terriyaki0212,

 

The reason for the issue will happen is caused by the formatDateTime() function recognize the first unit of the Time String is the month, so if it is greater than 12, it will report it is an invalid date.

So, you could convert the date into a format which month is in the head, for example:Annotation 2020-03-26 134757.png

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Highlighted
Frequent Visitor

Re: formatDateTime error

Thanks I tried that but I still get the error 'String was not recognized as a valid DateTime.' The formatDateTime expression applies to the Review Due Date column as shown. 

 

 Flow captureFlow capture

 

Highlighted
Frequent Visitor

Re: formatDateTime error

I finally managed to get it to work.

 

So instead of using 'dd/MM/yyyy', I switched it to 'MM/dd/yyyy' so the expression goes like this:

 

formatDateTime(body('Converted_time_to_NZ'), 'MM/dd/yyyy')

 

It finally worked. And my Review Due Date column still goes to dd/MM/yyyy format since I am using the New Zealand timezone in the site's settings.

 

View solution in original post

Highlighted
Dual Super User III
Dual Super User III

Re: formatDateTime error

@terriyaki0212 

Thankx for sharing the way you finally solve the issue! I've marked it as a solution, this way other users facing a similar problem can find a solution faster.

Some extra (OPTIONAL) steps you can take:

1.-(OPTIONAL)  Please note you can even select several replies as as 'Solution', even from different community members!

Flow_AcceptSolution.png

3.- (OPTIONAL) Click on 'Thumbs up' in any answer you found valuable.

Flow_thumbsUp.png

Even though this 2nd step is OPTIONAL, please remember it is the cheapest, easiest way to say thanks to somebody that simply tried to help. And just between you and me, everytime an inspiring answer receive a kudo, an ewok escapes from The Emperor menace  😉

 

Thanx for making this community great!



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Helpful resources

Announcements
FirstImage

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,967)