Skip to content

Instantly share code, notes, and snippets.

@zag2me
Created March 12, 2018 10:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zag2me/867882ad1fc4e35155b2edadcf3812bb to your computer and use it in GitHub Desktop.
Save zag2me/867882ad1fc4e35155b2edadcf3812bb to your computer and use it in GitHub Desktop.
Get current shortened soccer season
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