Posted By

landonmiller on 06/02/10


Tagged

php date


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

dantreacy
eval


Detect Season


 / Published in: PHP
 

Based on the Month range, this will display what time of the year it is and display content based on the season.

  1. //get current month
  2. $currentMonth=date("m");
  3.  
  4. //retrieve season
  5. if ($currentMonth>="03" && $currentMonth<="05")
  6. $season = "spring";
  7. elseif ($currentMonth>="06" && $currentMonth<="08")
  8. $season = "summer";
  9. elseif ($currentMonth>="09" && $currentMonth<="11")
  10. $season = "fall";
  11. else
  12. $season = "winter";

Report this snippet  

You need to login to post a comment.