Doc #70994 [Opn]: Does gmdate() use UTC or GMT?
| From: | derick@php.net | Date: | Sat, 19 Dec 2015 17:05:59 +0000 |
| Subject: | Doc #70994 [Opn]: Does gmdate() use UTC or GMT? | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-12994@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70994&edit=1
ID: 70994
Updated by: derick@php.net
Reported by: php at geheimeinformatie dot nl
Summary: Does gmdate() use UTC or GMT?
Status: Open
Type: Documentation Problem
Package: Date/time related
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
@ajf: No, GMT is GMT - i.e. UTC+0.
It does not change throughout the year. gmdate() uses UTC or, its expression GMT which is just
UTC+0.
Technically GMT and UTC, are not the same, but for PHP's purposes they are. For a background on
that: http://derickrethans.nl/leap-seconds-and-what-to-do-with-them.html
Previous Comments:
------------------------------------------------------------------------
[2015-12-19 16:58:13] ajf@php.net
"GMT observes European Summer Time"? Huh?
Greenwich Mean Time is always UTC+00:00. During the summertime in the UK, we switch to British
Summer Time, UTC+01:00, but GMT itself doesn't change. If the time zone is set to GMT, it will
always match UTC.
Am I missing something? Does PHP consider "GMT" to mean "Europe/London" instead?
------------------------------------------------------------------------
[2015-11-29 20:21:37] php at geheimeinformatie dot nl
Description:
------------
The name of the function "gmdate" seems to suggest GMT, but some experimentation indicates
that this function formats a date in UTC.
The documentation currently says:
> gmdate â Format a GMT/UTC date/time
> [...]
> Identical to the date() function except that the time returned is Greenwich Mean Time (GMT).
and most user submitted notes on the same page seem to indicate that GMT and UTC are basically the
same thing.
They're not.
GMT observes European Summer Time (or "daylight saving" to some), while UTC does not. So
for about half the time, the resulting values wil differ by one hour.
I recommend we change the documentation to remove all references to Greenwich (save for the one in
the function name), and only ever mention UTC.
Test script:
---------------
According to the following script:
<?php
var_dump(date("e"));
var_dump(gmdate("e"));
?>
which outputs:
> string(13) "Europe/Berlin"
> string(3) "UTC"
the documentation should read "UTC", not "GMT".
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70994&edit=1