Example
Example – Example for the usage of Date_Holidays
Basic example
This example shows you, how to calculate the Easter date of 2005.
<?php
require_once "Date/Holidays.php";
$germany = &Date_Holidays::factory('Germany', 2004, 'en_EN');
if (Date_Holidays::isError($germany)) {
die('Factory was unable to produce driver-object');
}
$easter = &$germany->getHoliday('easter', 'de_DE');
if (!Date_Holidays::isError($easter)) {
print_r($easter->toArray());
}
?>
This will return an array in the following format:
Array ( [internalName] => easter [title] => Easter Sunday [date] => date Object ( [year] => 2004 [month] => 04 [day] => 11 [hour] => 0 [minute] => 0 [second] => 0 [tz] => date_timezone Object ( [id] => UTC [longname] => Coordinated Universal Time [shortname] => UTC [hasdst] => [dstlongname] => Coordinated Universal Time [dstshortname] => UTC [offset] => 0 [default] => ) ) )