cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Phil_mc
Regular Visitor

strange error with formatdatetime

Working on a flow and currently i have a strange error related to formatdatetime. It works for 1 out of 3 inputs with the error:

Unable to process template language expressions in action 'Compose_17' inputs at line '1' and column '52106': 'In function 'formatDateTime', the value provided for date time string '30-03-2021' was not valid. The datetime string must match ISO 8601 format.'.

the inputs seems the same so unsure why it fails, any help is appreciated.

the flow uses : 

formatDateTime(outputs('Compose_4'),'dddd-MM-yyyy')

an image of it failing and working can be seen here : https://1drv.ms/u/s!AgdOuF0pxEgViXqFpgz78Qe2jvXm?e=z0HfQ0
1 ACCEPTED SOLUTION

Accepted Solutions
DamoBird365
Super User
Super User

Hi @Phil_mc 

 

It's because the date that you are supplying the expression is in the wrong format.  It will work for dates up to 12-MM-yyyy but anything above 12 will error because it expects the date in format MM-dd-yyyy.  So any date above 12 will fail as the month cannot be greater than 12.

 

If you cannot change the source, you need to re-format your date.  You can do this using a split on - (assuming it is dd-MM-yyyy) and then concat the elements of your split into the new order.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien


P.S. take a look at my new blog here

View solution in original post

2 REPLIES 2
DamoBird365
Super User
Super User

Hi @Phil_mc 

 

It's because the date that you are supplying the expression is in the wrong format.  It will work for dates up to 12-MM-yyyy but anything above 12 will error because it expects the date in format MM-dd-yyyy.  So any date above 12 will fail as the month cannot be greater than 12.

 

If you cannot change the source, you need to re-format your date.  You can do this using a split on - (assuming it is dd-MM-yyyy) and then concat the elements of your split into the new order.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien


P.S. take a look at my new blog here

View solution in original post

Phil_mc
Regular Visitor

Thanks a lot!
confirmed split has fixed the issue

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (2,610)