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
Community Champion
Community Champion

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
Community Champion
Community Champion

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
MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (89,130)