Forum Moderators: coopster
Working on a calendar project which displays various holidays throughout the year. Amoung the tricker ones is of course Easter. Then (thanks be to the Gods) that PHP has a built-in function to find easter sundays based upon the year you feed it.
So I tested it and ... huh? ... it echos that easter sunday for 2008 falls on Saturday, March 22, 2008.
Code Here:
echo 'Easter Sunday, 2008 falls on: ' , date('l, F d, Y', easter_date(2008));
Did I miss the memo where Easters are now on Saturdays, or am I doing something wrong, or is there something wrong with my system or the easter_date() function?
I've corrected the problem by adding a day's worth of seconds - easter_date(2008) + 86400 - but I find this curious (and not a little bit un-nerving).
Does anyone have any insight on what's going on?
Neophyte
Neophyte
Easter Sunday is simply the Sunday that is after the actual day of Easter (unless the it falls on a Sunday), so you will have to get easter_date() and then check if it is a Sunday - if not, keep adding a day until it is. So Easter this year is 22nd March, Easter Sunday is 23rd March.
[edited by: PCInk at 12:58 pm (utc) on Mar. 22, 2008]
The date of Easter Day was defined by the Council of Nicaea in AD325 as the Sunday after the first full moon which falls on or after the Spring Equinox.
date.timezone = UTCon my local development box and easter_date [php.net] returns the correct date. There is a known bug [bugs.php.net] as mentioned by vincevincevince that you may need to investigate on your particular installation.
Thank you all for your replies.
Coopster, I'm running php 5.2. I un-commented date.timezone in my .ini and added "= UTC" but still no dice locally - still reports Saturday. I did, however, put a test page with easter_date(2008) on my live hosting site and there it reports that easter IS on Sunday so I guess my particular problem has something to do with my dev environment. As long as it works on my hosting site, I'm okay.
Thanks again to all.
Neophyte