Re: Date Range?
| From: | Monte Ohrt | Date: | Thu, 19 Oct 2000 13:26:46 +0000 |
| Subject: | Re: Date Range? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-21150@lists.php.net to get a copy of this message | ||
Meaning that the entire month of October 2000 is contained within the
two dates, or any part of October 2000?
If the former, then this should work:
$startdate = mktime(0,0,0,05,18,2000);
$enddate = mktime(0,0,0,05,26,2002)
$startoct = mktime(0,0,0,10,1,2000);
$endoct = mktime(0,0,0,10,31,2000);
if( $startdate <= $startoct && $enddate >= $endoct )
echo "dates run through October 2000.";
else
echo "dates do not run through October 2000.";
If you need to check dates that are pre 1970 or post 2038, use Date_Calc
and date_to_days();
http://www.phpinsider.com/php/code/Date_Calc/
Monte
Alan Morey wrote:
>
> Hi all,
>
> I have a date range
> Start: MM-DD-YYYY
> End: MM-DD-YYYY
>
> How could i check if the Date range runs through a seleted Month and Year.
>
> eg.
>
> Start: 05-18-2000
> End: 05-26-2002
>
> Now this date range goes from 18th May 2000 to 26th May 2002
>
> I want to check if it runs through October 2000.
>
> Any ideas?
>
> Thanx
> alan
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/