Answer the question
In order to leave comments, you need to log in
How can I find unoccupied time in the lunch-time gap?
Hello.
The database stores working time and lunch in JSON in one column
I have a master who has a working time period and lunch or several breaks
There are different services, for example 1 hour 15 minutes, 30 minutes, etc.
Services are stored in the database by 1 line in datetime format The
question is how to check the time interval in PHP in order to write a new service, taking into account not to overlap with another.
The implementation is in PHP, since the system can no longer be redone
Answer the question
In order to leave comments, you need to log in
Already answered a similar question: How to check booked dates in a range of numbers?
You can take the validation class from there. You will only need to add the time to the constructor.
I had a similar project with table reservations in a restaurant, but the average load at a certain time was also calculated there, and so on.
Briefly:
1) Use intervals of time. If the service is 15 minutes, then write down the type of service, start time and end time. For subsequent calculations, this will be a plus.
2) Next, check the interval, whether it is included in any of the existing ones.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question