PHP Date and Time With Season or Weather Information

by Hiroshi on August 7, 2008

in Date & Time

This script will tell you current date and time with current season or weather.

<?php echo date("l, d F Y - H:i:s a ");
echo "(GMT+05:00) - ";
function season() {
   $limits=array('/12/21'=>'Winter','/09/21'=>'Autumn',
'/06/21'=>'Summer','/03/21'=>'Spring','/12/31'=>'Winter');
   foreach ($limits AS $key => $value) {
       $limit=date("Y").$key;
       if (strtotime("now")>strtotime($limit)) {
           return $value;
       }
   }
}
echo season();
?>

Sample Display
Thursday, 07 August 2008 – 01:04:27 am (GMT+05:00) – Summer

Download Script

Related Posts

Previous post:

Next post: