php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60236 TLA timezone dates are not converted properly from timestamp
Submitted: 2011-11-07 18:10 UTC Modified: 2011-11-24 17:14 UTC
From: stas@php.net Assigned: derick (profile)
Status: Closed Package: Date/time related
PHP Version: 5.4.0beta2 OS: *
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: stas@php.net
New email:
PHP Version: OS:

 

 [2011-11-07 18:10 UTC] stas@php.net
Description:
------------
If you convert a date with TLA timezone (like EDT) to timestamp, and then convert 
it back from timestamp, resulting date is off by an hour. See example below.

Test script:
---------------
<?php
$t   = new DateTime('2010-07-06 18:38:28 EDT'); 
$ts = $t->format('U');
var_dump($ts);
$t->setTimestamp($ts);
var_dump($t);


Expected result:
----------------
string(10) "1278455908"
object(DateTime)#1 (3) {
  ["date"]=>
  string(19) "2010-07-06 18:38:28"
  ["timezone_type"]=>
  int(2)
  ["timezone"]=>
  string(3) "EDT"
}


Actual result:
--------------
string(10) "1278455908"
object(DateTime)#1 (3) {
  ["date"]=>
  string(19) "2010-07-06 17:38:28"
  ["timezone_type"]=>
  int(2)
  ["timezone"]=>
  string(3) "EDT"
}


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-07 18:11 UTC] stas@php.net
-Assigned To: +Assigned To: derick
 [2011-11-21 02:18 UTC] danielc@php.net
This is probably related to https://bugs.php.net/bug.php?id=55253
 [2011-11-24 17:13 UTC] derick@php.net
Automatic comment from SVN on behalf of derick
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=319767
Log: - Fixed bug #60236 (TLA timezone dates are not converted properly from
  timestamp).
- Fixed bug #55253 (DateTime::add() and sub() result -1 hour on objects with
  time zone type 2).

And fixed some test cases.
 [2011-11-24 17:14 UTC] derick@php.net
-Status: Assigned +Status: Closed
 [2011-11-24 17:14 UTC] derick@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2012-04-18 09:47 UTC] laruence@php.net
Automatic comment on behalf of derick
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d0a898d2a2852e697ea3d3bde6136993b75ad4f4
Log: - Fixed bug #60236 (TLA timezone dates are not converted properly from   timestamp). - Fixed bug #55253 (DateTime::add() and sub() result -1 hour on objects with   time zone type 2).
 [2012-07-24 23:38 UTC] rasmus@php.net
Automatic comment on behalf of derick
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d0a898d2a2852e697ea3d3bde6136993b75ad4f4
Log: - Fixed bug #60236 (TLA timezone dates are not converted properly from   timestamp). - Fixed bug #55253 (DateTime::add() and sub() result -1 hour on objects with   time zone type 2).
 [2013-11-17 09:35 UTC] laruence@php.net
Automatic comment on behalf of derick
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d0a898d2a2852e697ea3d3bde6136993b75ad4f4
Log: - Fixed bug #60236 (TLA timezone dates are not converted properly from   timestamp). - Fixed bug #55253 (DateTime::add() and sub() result -1 hour on objects with   time zone type 2).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 11:01:29 2024 UTC