Re: Days until Easter and Christmas
| From: | David Robley | Date: | Sun, 16 Nov 2008 04:29:59 +0000 |
| Subject: | Re: Days until Easter and Christmas | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-283328@lists.php.net to get a copy of this message | ||
Ron Piggott wrote:
> Is there a way to modify this code so it will always be the *next*
> Christmas and Easter?
>
> <?php
>
> $todays_date_seasonal_format = DATE("Y-m-d");
> $next_Christmas = DATE("Y") . "-12-25";
> $next_Easter = date("D d M Y", strtotime("2009-03-21
> +".easter_days(2009)." days"));
> $days_until_Christmas = ( strtotime($next_Christmas) -
> strtotime($todays_date_seasonal_format) ) / 86400;
> $days_until_Easter = round(( strtotime($next_Easter) -
> strtotime($todays_date_seasonal_format) ) / 86400);
>
> echo $days_until_Christmas . "<br>";
> echo $days_until_Easter . "<br>";
Have you tried incrementing the year value by one when you define
$next_[holiday]
Cheers
--
David Robley
He who always plows a straight furrow is in a rut.
Today is Setting Orange, the 28th day of The Aftermath in the YOLD 3174.