Re: Intersecting Dates
| From: | Brian V Bonini | Date: | Sun, 27 Nov 2005 14:10:13 +0000 |
| Subject: | Re: Intersecting Dates | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-226509@lists.php.net to get a copy of this message | ||
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";