|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #26090 allow colons in time zone offset to strtotime()
Submitted: 2003-11-03 00:29 UTC Modified: 2005-06-28 23:23 UTC
From: danielc at analysisandsolutions dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 5.0.0b1 (beta1) OS: n/a
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: danielc at analysisandsolutions dot com
New email:
PHP Version: OS:


 [2003-11-03 00:29 UTC] danielc at analysisandsolutions dot com
The strtotime() function doesn't allow time zone offsets to contain colons ":" in them.  Colons are included in several offset formmating standards.

Reproduce code:
$t = '2003-10-28 10:20:30-0800';
echo date('Y-m-d H:i:s T', strtotime($t)) . "\n<br />\n";

$t = '2003-10-28 10:20:30-08:00';
echo date('Y-m-d H:i:s T', strtotime($t)) . "\n";

Expected result:
2003-10-28 13:20:30 EST
<br />
2003-10-28 13:20:30 EST

Actual result:
2003-10-28 13:20:30 EST
<br />
1969-12-31 18:59:59 EST

On Windows 2000, the attempt with the colons in the offset produces a negative timestamp, so the beloved "Windows does not support dates prior to midnight" warning arises.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-28 23:23 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

Fixed in PHP 5.1.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Apr 11 16:01:23 2021 UTC