|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44909 strtotime doesn't recognize UT timezone
Submitted: 2008-05-04 08:30 UTC Modified: 2008-05-04 08:54 UTC
Avg. Score:3.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: selsky at columbia dot edu Assigned:
Status: Wont fix Package: Date/time related
PHP Version: 5.2.6 OS: Solaris
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
29 - 15 = ?
Subscribe to this entry?

 [2008-05-04 08:30 UTC] selsky at columbia dot edu
strtotime() does not recognize the timezone "UT".  According to RFC 2822 and the comments in ext/date/php_date.c (line 384), the valid time zones are:

 *  zone        =  "UT"  / "GMT"  /  "EST" / "EDT"  /  "CST" / "CDT"  /  "MST" / "MDT"  /  "PST" / "PDT"  /  1ALPHA  / ( ("+" / "-") 4DIGIT )             

UTC is correctly recognized. was closed as won't fix, but this means we can't parse valid rfc2822 strings.

Reproduce code:
print strtotime('12 Sep 2007 15:49:12 UTC') . "\n";
print strtotime('12 Sep 2007 15:49:12 UT') . "\n";

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-05-04 08:54 UTC]
The comments to go with the line 384 you're mentioned are actually incorrect. RFC2822 in section 3.1, paragraph 3 it is stated that "These "obs-" elements refer to tokens defined in the obsolete syntax in section 4.  In all cases, these productions are to be ignored for the purposes of generating legal Internet messages and MUST NOT be used as part of such a message." As the comment deals with *generating* a date time string as part of a format, it is invalid to mention those obsolete timezones specifications. The nonterminals in the 2822 rfc starting with "obs-" are obsolete parts of the old (RFC 822) standard. We state in the manual ( which time zones we support, and "UT" is not one of those. First of all those timezone names from from a standardized timezone database, and secondly, UT would be semantically wrong as is explained in bug #42486.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Nov 28 02:05:53 2022 UTC