PHP

Background that adapts to the current season

TODAY

Wednesday: January 22, 2025

winter

PHP

<?php
function GetCurrentSeason() {

$seasonDates = array('/12/21'=>'winter',
'/09/21'=>'autumn',
'/06/21'=>'summer',
'/03/21'=>'spring',
'/01/01'=>'winter');

foreach ($seasonDates AS $seasonKey => $seasonValue) {
$seasonDate = date("Y").$seasonKey;
if (strtotime("now") > strtotime($seasonDate)) {
return $seasonValue;
}

}

}
$returnCurrentSeason = GetCurrentSeason();
?>

HTML

<div class="calendar-container"> 

 <div class="calendar-header">TODAY</div>
  <div class="calendar-body">
   <h2><?php echo date("l") . ": " . date("F") . " " . date("d") . ", " . date("Y"); ?></h2>
   <h3><?php echo $returnCurrentSeason; ?></h3>
  </div> 
  
 </div>