O'Reilly logo

PHP Programming with PEAR by Stoyan Stefanov, Carsten Lucke

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Date_Holidays

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required