note 53058 deleted from function.date by derick
| From: | derick@php.net | Date: | Sun, 15 Jan 2006 12:44:56 +0000 |
| Subject: | note 53058 deleted from function.date by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-101836@lists.php.net to get a copy of this message | ||
Note Submitter: searcher cookie dracon dot biz
----
There is always a confusion with daylight saving time and how your server handles it, so here's
a simple and quick fix
<?
# ~~~ GMT Time Magic v2.1 ~~~~~~~~~~ #
function GMT_Time($Stamp,$Change) {
return (($Stamp == 0) ? time() : $Stamp) - $Change * date("Z");
}
?>
And the final calling code for both gmdate() and gmmktime() commands
<?= date("l, F jS Y, H:i:s", GMT_Time($Timestamp,1) + 3600 * $Timezone) ?>
- and -
<?= GMT_Time($Timestamp,(-1)) + 3600 * $Timezone ?>
The tool based on this code can be found and freely used here:
http://www.dracon.biz/timestamp.php