Answer the question
In order to leave comments, you need to log in
How to check the coincidence of dates in a certain period?
There is a date for the set, for example: 2017-07-22 23:59:00 - 2019-04-20 23:59:00
It is stored in the database, when adding a new record, you need to check if the new interval is included in this date and throw a validation error, for example, this record: 2019-04-01 23:59:00 - 2019-04-30 23:59:00
it should cause an error.
I'm just wondering how can I check this? I understand that you need to use one of the Date classes built into php, but I could not find any such example on the Internet, can anyone help me?
Answer the question
In order to leave comments, you need to log in
convert dates to unixtime it's easier to compare)
a function for converting to unixtime - then strtotime()
I think everything is simple and does not require explanation
the range of dates of dates is stored directly in one line or 2 columns date?
if yes - first
and then, as above, they wrote through the functionstrtotime
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question