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.
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.

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
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

New Process Advisor Capabilities carousel.png

Read the blog for the latest news

Read the latest about new experiences and capabilities in the Power Automate product blog.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

AI Builder AMA June 7th carousel (up on May 25th, take down June 8th) (1).png

'Ask Microsoft Anything' about AI Builder!

The AI Builder team invite you to ask questions and provide helpful answers at our next AMA.

Users online (1,534)