cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Comparing timevalues in an If function

Hello,

 

I am trying to compare two hourvalues inside a if function. I thought it would work the same way as comparing two dates with each other, but it keeps telling me that it is expecting a number value. I tried using hourvalue.selected and .selected.value, but none of them seems to work. Is it even possible to compare times in powerapps or am I missing something?

 

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Power Apps
Power Apps

Re: Comparing timevalues in an If function

If the type of the data is text, then you can use the Value function to convert that to a number, something along the lines of

If(
    Value(hourvalue.Selected.Value) > Value(hourvalue2.Selected.Value),
    "First is greater",
    "Equal or second is greater")

View solution in original post

4 REPLIES 4
Highlighted
New Member

Comparing timevalues in an If function

Hello,

 

I am trying to compare two hourvalues inside a if function. I thought it would work the same way as comparing two dates with each other, but it keeps telling me that it is expecting a number value. I tried using hourvalue.selected and .selected.value, but none of them seems to work. Is it even possible to compare times in powerapps or am I missing something?

 

Thanks in advance!

Highlighted
New Member

Re: Comparing timevalues in an If function

Accidentally posted this question twice. My bad!

Highlighted
Power Apps
Power Apps

Re: Comparing timevalues in an If function

If the type of the data is text, then you can use the Value function to convert that to a number, something along the lines of

If(
    Value(hourvalue.Selected.Value) > Value(hourvalue2.Selected.Value),
    "First is greater",
    "Equal or second is greater")

View solution in original post

Highlighted
New Member

Re: Comparing timevalues in an If function

Worked out. Thank you very much

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (4,251)