Jump to content

Time Comparison


jeeva

Recommended Posts

hi frnds

 

i need ur help...

i have a form thats called Conference Room Booking. In that  i need to asking the user to select the between time(like 5:30 to 6:30)

Everything is ok. now my problem is i shud not allow the user to select the same time. for example

Another user has been requseted the time between 5:30pm to 6:30pm .Now i shud not allow the following times

thats

4:30 to 5:00

5:30 to 6:00

and so on

 

i tried to solve this problem but i couldn't get the idea for that...

 

any one have solved the same problem? if Yes let me know please...

 

 

jeeva

 

Link to comment
https://forums.phpfreaks.com/topic/45259-time-comparison/
Share on other sites

There was a similar question asked last week, and here's what we came up with. There is a method you need to follow that will give you what you're after. Let's say that you have the user input their start and end dates: you need to run a query and see if any of four things are true of the date range inserted:

 

  • Does the start time lie within the range of any existing events?
  • Does the end time lie within the range of any existing events?
  • Do any existing start times lie within the range of this new event?
  • Do any existing end times lie within the range of this new event?

 

If these four checks all return FALSE, you have a clean range, and you can successfully insert it into your schedule.

Link to comment
https://forums.phpfreaks.com/topic/45259-time-comparison/#findComment-219745
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.