Checking the season

From: Date: Sat, 05 Jan 2002 03:32:46 +0000
Subject: Checking the season
Groups: php.general 
Request: Send a blank email to php-general+get-79529@lists.php.net to get a copy of this message
Hi, Just need a sounding board to help me think this through. I want to check the current date to determine what "season" it is and display the appropriate picture. I define spring as 03/21/YYYY, summer as 06/21/YYYY, autumn as 09/21/YYYY, and winter as 12/21/YYYY. I form a string for the current date and get a timestamp via mktime(). I also get the equivalent timestamps for the dates above for the seasonal changes. Then, I compare the current date to see if it's between the seasonal dates. The problem is when I go from 12/31/YYYY to 01/01/(YYYY+1). Since winter and spring dates are one year apart, the current date timestamp comparison gets messed up and nothing displays. How do I do a proper comparison? I was thinking of just seeing if the current date timestamp is greater than each of the seasonal date timestamp, but it feels like I would miss something. Would I? Or is there another solution? Thank you for your time. --Stephen

« previous php.general (#79529) next »