Re: Intersecting Dates

From: Date: Sat, 26 Nov 2005 22:35:43 +0000
Subject: Re: Intersecting Dates
References: 1  Groups: php.general php.general 
Request: Send a blank email to php-general+get-226499@lists.php.net to get a copy of this message
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

« previous php.general (#226499) next »