note 27703 added to function.date
| From: | nad at win-win-marketing dot com | Date: | Mon, 16 Dec 2002 15:50:13 +0000 |
| Subject: | note 27703 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-40967@lists.php.net to get a copy of this message | ||
Here is a simple function you can call to get Date & Time in your Time Zone.
function gtdate($off, $hrs, $mn, $zn)
{
//
// $off refers to offset from GMT time.
// East of GM would be (+1) & West (-1)
// $hrs offset hours
// $mn offset minutes
// $zn Your Time Zone eg. HKT is HongKong Standard Time
// US-EST is United States - Eastern Standard Time
// which is Atlanta Time (hence $atl)
//
$offset=$off*(($hrs*60+$mn)*60);
$atl = gmdate('D d M Y H:i:s ',date('U') + $offset)."$zn";
return $atl;
} //End--------------------------------------
Example: To get Atlanta time:
$atl=gtdate(-1, 5, 0, "US-EST");
Results:
Mon 16 Dec 2002 10:37:30 US-EST
--
http://www.php.net/manual/en/function.date.php
http://master.php.net/manage/user-notes.php?action=edit+27703
http://master.php.net/manage/user-notes.php?action=delete+27703
http://master.php.net/manage/user-notes.php?action=reject+27703