note 38437 deleted from function.date by kennyt
| From: | kennyt@php.net | Date: | Sun, 18 Jul 2004 17:29:00 +0000 |
| Subject: | note 38437 deleted from function.date by kennyt | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-73515@lists.php.net to get a copy of this message | ||
Note Submitter: www.theutherfish.com
----
I recently made a small christmas countdown script. It currently only works in days e.g. start it at
the beginning of the month, but it can be adapted easily to include months by using the numerical
representations. Sorry about the use of crimbo in the vars, i was just making it as short as
possible, enjoy:
<?
$crimboday = 24;
$date = date('d');
$dayleft = $crimboday-$date;
$crimbohour = 18;
$hour = date('G');
$hourleft = $crimbohour-$hour;
$crimbomins = 60;
$mins = date('i');
$minsleft = $crimbomins-$mins;
if ($dayleft < 0) {
echo "Merry Christmas!";
}
else{
print $dayleft." days, ".$hourleft." hours and ".$minsleft." minutes until
Christmas!";
}
?>
Please note the $crimbohour variable should be 23 if you want it in the time zone of your server. As
my server is in seattle and i needed GMT, i minused 5 from this to give 18. The same can be done for
all time zones to make it display correctly for your time zone.