wishthis/includes/functions/getCurrentSeason.php

27 lines
499 B
PHP
Raw Normal View History

2021-11-15 11:47:58 +00:00
<?php
/**
* getCurrentSeason
*
* Returns the current season
*/
function getCurrentSeason(): string
{
2021-11-15 11:55:01 +00:00
$now = time();
$month = date('n');
$season = '';
$startOfYear = strtotime('01. January');
$startOfEaster = strtotime('15. April'); // Approximate
$startOfChristmas = strtotime('24. December');
if ($now <= $startOfEaster) {
$season = 'Easter';
} elseif ($now <= $startOfChristmas) {
$season = 'Christmas';
}
return $season;
2021-11-15 11:47:58 +00:00
}