web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Time between Start tim...
Power Apps
Unanswered

Time between Start time and End time should be blocked.

(0) ShareShare
ReportReport
Posted on by 6

Hi,

i'm trying to block time between start time and end time.

I have 4 drop downs

start time - hours and minutes

end time - hours and minutes

Screenshot (43).png

User can book only 2 hours / slot

 

If one user blocks the time between 8am - 10am, others should not be allowed to book time slot btw 8-10

only can book before or after hours. 

 

Screenshot (44).png

 

tried the above code by comparing date and time, but when user changes minutes value, it is allowing to book the slot. because it is not matching the exact value. >/ < are not working. 

 

please help.

Thank you. 

 

 

 

Categories:
I have the same question (0)
  • mmollet Profile Picture
    3,187 on at

    You could try just using numbers instead of datetime objects. For example instead of 8:15AM just use 815. This will give you numbers and make comparisions much easier in general. You could also convert all time to minutes from midnight. So again 8:15AM would be 8(60) + 15 = 495. I have done this for a few apps and it simplified the logic. You can always convert it back into a datetime object anyway. 

  • DeepthiKasey Profile Picture
    6 on at

    What exactly is the formula need to be use.. i have converted it into numbers like how you mentioned and saving those values to the backend with 2 text columns (TimeStart & TimeEnd) as well. Example,storing values  like 815(TimeStart) & 1015(TimeEnd). Now i need to restrict values between these two column values. 

     

    If(!IsBlank(LookUp('Recreational activities','Court Text'=DataCardValue15.Text &&
    Value(TimeStart) <Value(DataCardValue49.Text) , Value(TimeEnd)>Value(DataCardValue50.Text))),Notify("This slot is booked please book another slot"),SubmitForm(Form1));

     

    Please help

    Thank you

     

     

  • DeepthiKasey Profile Picture
    6 on at

    What exactly is the formula need to be use.. i have converted it into numbers like how you mentioned and saving those values to the backend with 2 text columns (TimeStart & TimeEnd) as well. Example,storing values  like 815(TimeStart) & 1015(TimeEnd). Now i need to restrict values between these two column values. 

     

    If(!IsBlank(LookUp('Recreational activities','Court Text'=DataCardValue15.Text &&
    Value(TimeStart) <Value(DataCardValue49.Text) , Value(TimeEnd)>Value(DataCardValue50.Text))),Notify("This slot is booked please book another slot"),SubmitForm(Form1));

     

    Please help

    Thank you

     

    Screenshot (47).png

     

  • mmollet Profile Picture
    3,187 on at

    compValue is going to be the value you are checking:

    If(compValue > Value(TimeStart) And compValue < Value(TimeEnd), **good number**, **bad number**)

    replace the stuff in ** with the true and false statements you want to execute based on the output of the if statement.

    Start time was 8:15AM -> converted this is 0815

    End time was 4:30PM -> converted this is 1630

    compValue is 12:45 -> converted this is 1245

    If(1245>0815 And 1245<1630, "Time Is In Range", "Time Is Out of Range")

  • DeepthiKasey Profile Picture
    6 on at

    One last question,

    how you are calculating compvalue?

    i have a slot 900 - 1100(9am - 11am)

    i have taken startTime - 1030(10:30am) ,Endtime - 1230 (12:30pm)

    calculated compvalue like ,(1030 +1230) /2 = 1130

     

    if I use this values for the formula,

    If(1130>900 And 1130<1100, "Time Is In Range", "Time Is Out of Range").

     

    condition is not satisfying.. it is with the compvalue calculation. How to calculate that value?

     

    Help me with this please

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 429 Most Valuable Professional

#2
11manish Profile Picture

11manish 191 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 122 Super User 2026 Season 2

Last 30 days Overall leaderboard