php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #70994 Does gmdate() use UTC or GMT?
Submitted: 2015-11-29 20:21 UTC Modified: 2015-12-19 17:06 UTC
From: php at geheimeinformatie dot nl Assigned:
Status: Not a bug Package: Date/time related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2015-11-29 20:21 UTC] 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".


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-12-06 21:55 UTC] stas@php.net
-Package: PHP Language Specification +Package: Date/time related
 [2015-12-19 16:58 UTC] 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-12-19 17:05 UTC] derick@php.net
@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
 [2015-12-19 17:06 UTC] derick@php.net
-Status: Open +Status: Not a bug
 [2015-12-19 17:06 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 14:01:29 2024 UTC