Created
March 12, 2018 10:05
-
-
Save zag2me/867882ad1fc4e35155b2edadcf3812bb to your computer and use it in GitHub Desktop.
Get current shortened soccer season
This file contains 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
function currentSeason() { | |
// The current shortened football season | |
if (date('n') > 8) { | |
// Check if its past August for new season | |
$year1 = substr(date("Y",strtotime("+1 year")),2,4); | |
$year2 = substr(date("Y"),2,4); | |
} else { | |
// Check if its before August for current season | |
$year1 = substr(date("Y"),2,4); | |
$year2 = substr(date("Y",strtotime("-1 year")),2,4); | |
} | |
$season = $year2.$year1; | |
return $season; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment