Skip to content

Instantly share code, notes, and snippets.

@smiler
Created March 5, 2012 09:48
Show Gist options
  • Save smiler/1977666 to your computer and use it in GitHub Desktop.
Save smiler/1977666 to your computer and use it in GitHub Desktop.
function easterDay($y) {
// Se http://aa.usno.navy.mil/faq/docs/easter.html
$c = floor($y / 100);
$n = $y - 19 * floor( $y / 19 );
$k = floor(( $c - 17 ) / 25);
$i = $c - floor($c / 4) - floor(( $c - $k ) / 3) + 19 * $n + 15;
$i = $i - 30 * floor( $i / 30 );
$i = $i - floor( $i / 28 ) * ( 1 - floor( $i / 28 ) * floor( 29 / ( $i + 1 ) )
* floor( ( 21 - $n ) / 11 ) );
$j = $y + floor($y / 4) + $i + 2 - $c + floor($c / 4);
$j = $j - 7 * floor( $j / 7 );
$l = $i - $j;
$m = 3 + floor(( $l + 40 ) / 44); // month
$d = $l + 28 - 31 * floor( $m / 4 ); // day
return ($m == 3 ? $d : $d+31);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment