Created
August 27, 2014 18:38
-
-
Save Programie/671b2f3374c2534cc332 to your computer and use it in GitHub Desktop.
Get a list of holidays in the specified year
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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