Re: Intersecting Dates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux