note 28717 added to function.date
| From: | bofh at mtel dot net | Date: | Wed, 22 Jan 2003 10:43:38 +0000 |
| Subject: | note 28717 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-42568@lists.php.net to get a copy of this message | ||
//Easter calculation based upon Oudin's Algorithm
function easter($year,$ortodox=false)
{
$g = ($year % 19);
$i = (19*$g + 15) % 30;
$j = ($year + $year/4 + $i)%7;
$l = $i - $j;
$month = (int) (3 + (int)($l+40)/44);
$day = (int) ($l + 28 - (31*(int)($month/4)));
$date = "$year-$month-$day"; $tstamp = strtotime($date);
return ($ortodox)?date("Y-m-d",$tstamp):date("Y-m-d",strtotime("+13
days",$tstamp));
}
$date = easter(2002);
print $date;
--
http://www.php.net/manual/en/function.date.php
http://master.php.net/manage/user-notes.php?action=edit+28717
http://master.php.net/manage/user-notes.php?action=delete+28717
http://master.php.net/manage/user-notes.php?action=reject+28717