Skip to content

Instantly share code, notes, and snippets.

@Programie
Created August 27, 2014 18:38
Show Gist options
  • Select an option

  • Save Programie/671b2f3374c2534cc332 to your computer and use it in GitHub Desktop.

Select an option

Save Programie/671b2f3374c2534cc332 to your computer and use it in GitHub Desktop.
Get a list of holidays in the specified year
<?php
/**
* Returns the holidays of the given year
*
* @param int $year The year of which the holidays should be returned
* @return array The holidays (Each element represents a date in format Y-m-d)
*/
function getHolidays($year)
{
$easterSunday = easter_date($year);
return array
(
$year . "-01-01",
$year . "-01-06",
date("Y-m-d", strtotime("-2 day", $easterSunday)),
date("Y-m-d", strtotime("+1 day", $easterSunday)),
$year . "-05-01",
date("Y-m-d", strtotime("+39 day", $easterSunday)),
date("Y-m-d", strtotime("+50 day", $easterSunday)),
date("Y-m-d", strtotime("+60 day", $easterSunday)),
$year . "-10-03",
$year . "-11-01",
$year . "-12-25",
$year . "-12-26"
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment