note 83227 added to function.gmmktime
| From: | ben at sixg dot com | Date: | Fri, 16 May 2008 00:17:57 +0000 |
| Subject: | note 83227 added to function.gmmktime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-139428@lists.php.net to get a copy of this message | ||
As an addendum to my previous note (php.net said it was too long and I had to split this part off),
I'll leave you with one more fun tidbit. :)
(See the note below this one for a full explanation of timezones versus unix timestamps.)
3 AM PST == 11 AM GMT, right? 11 AM _GMT_ > 3 AM _GMT_ (same timezone) right? So, logically, 3
AM PST > 3 AM GMT. (Makes sense right, it is 3 AM in California 8 hours after it is 3 AM in
Greenwich.) Now, because timestamps are timezone-independent (or, always GMT/UTC), you get a
strange situation. mktime(3) > gmmktime(3). Even though PST is GMT-8, so PST is less than GMT,
mktime(3) is _greater_ than gmmktime(3). At first glance you'd probably expect mktime(3) to be
less than gmmktime(3), but because of everything I described before, about how timestamps are always
GMT/UTC (or, in some senses, no timezone at all), it ends up being "backwards." (Run a
few examples yourself if you don't believe me.) Yet another reason not to try to deal with
timezones at the timestamp level!
----
Server IP: 69.147.83.197
Probable Submitter: 67.126.53.106
----
Manual Page -- http://www.php.net/manual/en/function.gmmktime.php
Edit -- https://master.php.net/note/edit/83227
Del: integrated -- https://master.php.net/note/delete/83227/integrated
Del: useless -- https://master.php.net/note/delete/83227/useless
Del: bad code -- https://master.php.net/note/delete/83227/bad+code
Del: spam -- https://master.php.net/note/delete/83227/spam
Del: non-english -- https://master.php.net/note/delete/83227/non-english
Del: in docs -- https://master.php.net/note/delete/83227/in+docs
Del: other reasons-- https://master.php.net/note/delete/83227
Reject -- https://master.php.net/note/reject/83227
Search -- https://master.php.net/manage/user-notes.php