This function returns an array of timestamp corresponding to Dutch National holidays. Liberation Day (Bevrijdingsdag) is added as a National holiday once every five years (2000, 2005, 2010, ...).
<?php
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, 12, 25, $year),
mktime(0, 0, 0, 12, 26, $year)
);
if (($year % 5) == 0) {
$holidays[] = mktime(0, 0, 0, 5, 5, $year);
}
if ($year <= 2013) { if (date('w', mktime(0, 0, 0, 4, 30, $year)) == 0) { $holidays[] = mktime(0, 0, 0, 4, 29, $year); } else {
$holidays[] = mktime(0, 0, 0, 4, 30, $year); }
} else { if (date('w', mktime(0, 0, 0, 4, 27, $year)) == 0) { $holidays[] = mktime(0, 0, 0, 4, 26, $year); } else {
$holidays[] = mktime(0, 0, 0, 4, 27, $year); }
}
$holidays[] = strtotime('-2 days', mktime(0, 0, 0, $easterMonth, $easterDay, $easterYear));
$holidays[] = mktime(0, 0, 0, $easterMonth, $easterDay, $easterYear);
$holidays[] = strtotime('+1 days', mktime(0, 0, 0, $easterMonth, $easterDay, $easterYear));
$holidays[] = strtotime('+39 days', mktime(0, 0, 0, $easterMonth, $easterDay, $easterYear));
$holidays[] = strtotime('+49 days', mktime(0, 0, 0, $easterMonth, $easterDay, $easterYear));
$holidays[] = strtotime('+50 days', mktime(0, 0, 0, $easterMonth, $easterDay, $easterYear));
sort($holidays);
return $holidays;
}
$holidays = getHolidays(2014);
foreach ($holidays as $holiday) {
echo date('d-M-Y', $holiday) . '<br>';
}
?>