cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PVosEska Resolver I
Resolver I

Check is timevalue is between values

Hi,

 

I have a SQL-Table with a DateTime Column.

I have a Form in powerapps that splits the column in Dates, hours and minutes

 

I want to automatically Update a textbox on hour and minute values.

 

for example:

If the time is between;

05:45 - 13:44 (Update with value A)
13:45 - 21:44 (Update with value B)
21:45 - 05:45 (Update with value C)

 

Any idea to do this?

 

Regards,

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User
Super User

Re: Check is timevalue is between values

@PVosEska 

Put this formula in the Text property of your label or text input.

 

With(
   {myTime: Time(drpdown_hour.Selected.Value, drpdown_minute.Selected.Value, 0)},
   If(
       myTime > Time(5,45,0), "C",
       myTime <= Time(5,45,00) And myTime > Time(13,45,0), "A",
       myTime <= Time(13,45,00) And myTime > Time(21,45,0), "B",
       myTime <= Time(21,45,00), "C"
   )
)

 

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

View solution in original post

PVosEska Resolver I
Resolver I

Re: Check is timevalue is between values

That was a great start @mdevaney ,

 

The only issue was the time from 00:00 to 05:45. 

I changed the formula a little, and it works great now.

 

With(
   {myTime: Time(HourValue1.Selected.Value,MinuteValue1.Selected.Value, 0)},
   If(
       myTime >= Time(00,00,0) And myTime < Time(5,45,00), "N",
       myTime >= Time(5,45,00) And myTime < Time(13,45,0), "O",
       myTime >= Time(13,45,00) And myTime < Time(21,45,0), "M",
       myTime >= Time(21,45,00), "N"
   )
)

 

 Thanks for the very quick reply!

View solution in original post

3 REPLIES 3
Super User
Super User

Re: Check is timevalue is between values

@PVosEska 

Put this formula in the Text property of your label or text input.

 

With(
   {myTime: Time(drpdown_hour.Selected.Value, drpdown_minute.Selected.Value, 0)},
   If(
       myTime > Time(5,45,0), "C",
       myTime <= Time(5,45,00) And myTime > Time(13,45,0), "A",
       myTime <= Time(13,45,00) And myTime > Time(21,45,0), "B",
       myTime <= Time(21,45,00), "C"
   )
)

 

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

View solution in original post

dynamicsedge Power Participant
Power Participant

Re: Check is timevalue is between values

@PVosEska 

 

Try this related solution:

 

Compare two times 

 

PVosEska Resolver I
Resolver I

Re: Check is timevalue is between values

That was a great start @mdevaney ,

 

The only issue was the time from 00:00 to 05:45. 

I changed the formula a little, and it works great now.

 

With(
   {myTime: Time(HourValue1.Selected.Value,MinuteValue1.Selected.Value, 0)},
   If(
       myTime >= Time(00,00,0) And myTime < Time(5,45,00), "N",
       myTime >= Time(5,45,00) And myTime < Time(13,45,0), "O",
       myTime >= Time(13,45,00) And myTime < Time(21,45,0), "M",
       myTime >= Time(21,45,00), "N"
   )
)

 

 Thanks for the very quick reply!

View solution in original post

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Top Solution Authors
Top Kudoed Authors
Users online (7,788)