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.

Comments

Comment by Gregory on .
Gregory
calculating the phase of the moon is a pain in the arse. There's a mathmatical forumula for it, but I can't find two places that agree what it is. I used a simple one to create a nice blog graphic that showed the current phase of the moon (and could show any dates phase) but it wasn't perfectly accurate. Sometimes it was a night or two out. Still... not too bad for a first try. If you find a good calulation please let me know!