Re: Intersecting Dates

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

 



On Sat, 2005-11-26 at 16:18, 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?


Convert each to epoch and test for > floor < ceiling, just a thought.

$a = array(mktime(0, 0, 0, 1, 1, date('Y')), // floor
           mktime(0, 0, 0, 4, 1, date('Y')), // ceiling
           mktime(13, 45, 0, 3, 15, 2005)    // random date
          );

echo ($a[3] > $a[1] && $a[3] < $a[2]) ? "in range" : "out of range";

-- 
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