I recently had to write a function that allows me to know if today is a holiday.
And in France, we have some holidays which depends on the easter date. Maybe this will be helpful to someone.
Just modify in the $holidays array the actual holidays dates of your country.
<?php
protected static function getHolidays($year = null)
{
if ($year === null)
{
$year = intval(date('Y'));
}
$easterDate = easter_date($year);
$easterDay = date('j', $easterDate);
$easterMonth = date('n', $easterDate);
$easterYear = date('Y', $easterDate);
$holidays = array(
mktime(0, 0, 0, 1, 1, $year), mktime(0, 0, 0, 5, 1, $year), mktime(0, 0, 0, 5, 8, $year), mktime(0, 0, 0, 7, 14, $year), mktime(0, 0, 0, 8, 15, $year), mktime(0, 0, 0, 11, 1, $year), mktime(0, 0, 0, 11, 11, $year), mktime(0, 0, 0, 12, 25, $year), mktime(0, 0, 0, $easterMonth, $easterDay + 2, $easterYear),
mktime(0, 0, 0, $easterMonth, $easterDay + 40, $easterYear),
mktime(0, 0, 0, $easterMonth, $easterDay + 50, $easterYear),
);
sort($holidays);
return $holidays;
}
?>