owen

After reading a couple of articles on how to compute the date of Easter, I wrote up this simple PHP code snippet that will do it for any date from 2000 to 2199.

< ?php

$year = 2006;

$G = $year % 19 + 1;
$S = (11 * $G - 6) % 30;
$S = $S == 0 ? 1 + ($G > 12 ? 1 : 0): $S;
$FullMoon = mktime(0, 0, 0, 4, 19 - $S, $year);
$d_ary = getdate($FullMoon);
$d_ary[‘mday’] += $d_ary[‘wday’] > 0 ? 7 - $d_ary[‘wday’] : 0;
$Easter = mktime(0, 0, 0, $d_ary[‘mon’], $d_ary[‘mday’], $d_ary[‘year’]);

echo date(‘D, F jS’, $Easter);
?>

Also of interest to me is calculating full moon dates, which is what this code needs to do to forecast Easter. I wonder if there’s code out there to do that more reliably.