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 Automate
Unanswered

formatDateTime error

(0) ShareShare
ReportReport
Posted on by

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?

 

Categories:
I have the same question (0)
  • efialttes Profile Picture
    14,756 on at
    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!
  • Community Power Platform Member Profile Picture
    on at
     

    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

     

  • efialttes Profile Picture
    14,756 on at

    Can you try with this format instead?

    Flow_ConverTimeZone.png

    Hope this helps

    Hi!

  • Community Power Platform Member Profile Picture
    on at

    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.

  • v-litu-msft Profile Picture
    on at

    Hi @Anonymous,

     

    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.

  • Community Power Platform Member Profile Picture
    on at

    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

     

  • Verified answer
    Community Power Platform Member Profile Picture
    on at

    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.

     

  • efialttes Profile Picture
    14,756 on at

    @Anonymous 

    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!

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 406 Moderator

#3
abm abm Profile Picture

abm abm 245 Most Valuable Professional

Last 30 days Overall leaderboard