Re: amount of overlaping dates

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

 



2009/12/3 Merlin Morgenstern <merlin_x@xxxxxxxxxxx>:

> I am searching for a way to identify the amount of simultanious date ranges.
>
> Example:
>
> array start=('1.12', '5.12', '9.12');
> array end =('8.12', '12.12', '16.12');
>
> Looks like this in a table:
> start   end
> 1.12    8.12
> 5.12    12.12
> 9.12    16.12
>
> Obviously the first and last daterange do not overlap. So the amount of
> overlaping bookings is 2. But how to identify this with PHP?!

Store the start and end times of each event in an SQL table.

SELECT COUNT(*) FROM `event` WHERE `start` <= NOW() AND `end` >= NOW()

gets you the number of events that are happening right now.

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