cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
k1ng
Helper I
Helper I

"Greater than" with Convert Time in Microsoft Flow

Hey All,

 

I am having issues trying to greater then or lower than...  I tried to use the formatDateTime but still no dice:

 

Here is what I am getting on the failed run:
Unable to process template language expressions for action 'Condition_2' at line '1' and column '2320': 'In function 'formatDateTime', the value provided for date time string '05' was not valid. The datetime string must match ISO 8601 format.'.

 

2021-03-16_5-25-04.png

 

Any ideas?

-n

2 ACCEPTED SOLUTIONS

Accepted Solutions
annajhaveri
Super User
Super User

@k1ng As you are comparing just the hour in the condition, you just need to provide 05 or 5 value in the right side of condition as shown in below screenshot

annajhaveri_0-1615896269134.png

 

 

Regards,
Anna Jhaveri

If I have answered your question, please mark the post as Solved to help other users to identify the correct answer
If you like my response, please give it a Thumbs Up.

View solution in original post

@k1ng  sorry my bad, you need to convert hour value to integer, so please use below expression on left side of both conditions, you need to provide expression from Dynamic Content -> expression

 

int(body('Convert_time_zone'))

annajhaveri_0-1615899958591.png

 

Regards,
Anna Jhaveri

If I have answered your question, please mark the post as Solved to help other users to identify the correct answer
If you like my response, please give it a Thumbs Up.

View solution in original post

8 REPLIES 8
annajhaveri
Super User
Super User

@k1ng As you are comparing just the hour in the condition, you just need to provide 05 or 5 value in the right side of condition as shown in below screenshot

annajhaveri_0-1615896269134.png

 

 

Regards,
Anna Jhaveri

If I have answered your question, please mark the post as Solved to help other users to identify the correct answer
If you like my response, please give it a Thumbs Up.

View solution in original post

k1ng
Helper I
Helper I

@annajhaveri, works for 05 not for 17 however?  Get this now:
Unable to process template language expressions for action 'Condition_2' at line '1' and column '2320': 'The template language function 'greaterOrEquals' expects two parameter of matching types. The function was invoked with values of type 'String' and 'Integer' that do not match.'. ?

(tried just 17 and the same result)
Capture.PNG

@k1ng  sorry my bad, you need to convert hour value to integer, so please use below expression on left side of both conditions, you need to provide expression from Dynamic Content -> expression

 

int(body('Convert_time_zone'))

annajhaveri_0-1615899958591.png

 

Regards,
Anna Jhaveri

If I have answered your question, please mark the post as Solved to help other users to identify the correct answer
If you like my response, please give it a Thumbs Up.

View solution in original post

Thank you Anna!

@annajhaveri Shoot I lied lol.

Unable to process template language expressions for action 'Condition_2' at line '1' and column '2320': 'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'.
third.png

 

Basically, I just want to know if the current time is after hours (7am-5pm)... I need to change that from 05 to 07 lol 

@k1ng it should have worked, what is the output value of convert time action when you got this error?

Regards,
Anna Jhaveri

If I have answered your question, please mark the post as Solved to help other users to identify the correct answer
If you like my response, please give it a Thumbs Up.

Apparently flow doesn't like 'HH' only.  Got this:
Unable to process template language expressions for action 'Condition_2' at line '1' and column '2320': 'In function 'formatDateTime', the value provided for date time string '17' was not valid. The datetime string must match ISO 8601 format.'.

 

However when I did this:
formatDateTime(body('Current_time'),'HH:mm') >= formatDateTime('17:00','HH:mm') formatDateTime(body('Current_time'),'HH:mm') <= formatDateTime('07:00','HH:mm')

 

It worked 😉  Thank you again Anna 🙂

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!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Microsoft Ignite 768x460.png

Find your focus

Explore the latest tools,training sessions,technical expertise, networking and more.

Users online (1,624)