
The code below will show you can use PHP to get the current season.
The Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<?php function GetSeason() { $SeasonDates = array('/12/21'=>'Winter', '/09/21'=>'Autumn', '/06/21'=>'Summer', '/03/21'=>'Spring', '/01/01'=>'Winter'); foreach ($SeasonDates AS $key => $value) // Loop through the season dates { $SeasonDate = date("Y").$key; if (strtotime("now") > strtotime($SeasonDate)) // If we're after the date of the starting season { return $value; } } } $currentSeason = GetSeason(); ?> |