note 17374 added to function.date

From: Date: Thu, 06 Dec 2001 10:20:28 +0000
Subject: note 17374 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-21664@lists.php.net to get a copy of this message
For people who don't have the "Calendar" library compiled in PHP. Here is the source code of the function easter() which calculates all relevant information about the easter sunday of a given year. Have fun <? function easter($y) { $a = $y%19; $b = intval($y/100); $c = $y%100; $d = intval($b/4); $e = $b%4; $f = intval(($b+8)/25); $g = intval(($b-$f+1)/3); $h = (19*$a+$b-$d-$g+15)%30; $i = intval($c/4); $k = $c%4; $l = (32+2*$e+2*$i-$h-$k)%7; $m = intval(($a+11*$h+22*$l)/451); $p = ($h+$l-7*$m+114)%31; $EasterMonth = intval(($h+$l-7*$m+114)/31); // [3 = March, 4 = April] $EasterDay = $p+1; // (day in Easter Month) return array( "day" => $EasterDay, "month" => $EasterMonth, "year" => $y, "timestamp" => mktime(0,0,0, $EasterMonth, $EasterDay, $y), "day_of_year" => date("z", mktime(0,0,0, $EasterMonth, $EasterDay, $y)) ); } ?> -- http://www.php.net/manual/en/function.date.php http://master.php.net/manage/user-notes.php?action=edit+17374 http://master.php.net/manage/user-notes.php?action=delete+17374 http://master.php.net/manage/user-notes.php?action=reject+17374

« previous php.notes (#21664) next »