If you develop an application that needs to calculate holidays, PEAR::Date_Holidays
is certainly a helpful solution. Its main job is calculating holidays (or other special days) and checking whether dates represent holidays. It hides the complexity of calculating non-static holidays like Easter or Whitsun. Additionally it allows for easy filtering of holidays and is I18N aware, in so far as it provides information about holidays in different languages.
Checking if your birthday in 2005 is a holiday is as easy as:
require_once 'Date/Holidays.php'; $driver = Date_Holidays::factory('Christian', 2005); // actually this checks my date of birth ;-) if($driver->isHoliday(new Date('2005-09-09'))) { echo 'Oh happy day! Holiday and birthday all at once.'; } else { echo 'Jay, it is my birthday.'; }
So, if you do not want to reinvent the wheel for a library calculating holidays that occur on different dates in different religions/countries, use Date_Holidays
.
Before we start coding there...