note 27703 deleted from function.date by sniper
| From: | sniper@php.net | Date: | Sat, 11 Oct 2003 16:51:25 +0000 |
| Subject: | note 27703 deleted from function.date by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58272@lists.php.net to get a copy of this message | ||
Note Submitter: nad@win-win-marketing.com
----
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