|
Posted by "M. Sokolewicz" on 11/27/05 00:35
Shaun wrote:
> Hi,
>
> Given a start day and month and end day and month (i.e. 01-01 to 31-03) how
> can one check if another set intersects these dates?
>
> Thanks for your advice
one possibility is to change the dates to timestamps, then check if the
starting date (to intersect) is > $start or < $end, and check if the end
date (intersect) is > $start or < $end. If any of those are true, it
intersects.
(use strtotime() or some similair function to change 01-01 => 31-03)
another would be splitting dates and doing the same thing for months,
followed by days (if months of both equal)
other possibilities also exist obviously (eg. you could use mysql's
BETWEEN syntax)
- tul
Navigation:
[Reply to this message]
|