From:             luttkens at gmail dot com
Operating system: Any
PHP version:      5.4.7RC1
Package:          Date/time related
Bug Type:         Bug
Bug description:getTimestamp() affected by setTimezone() on DST transition

Description:
------------
getTimestamp() is supposed to return the time in UNIX-timestamp. To my 
understanding a unix timestamp is always in UTC and not affected by the
timezone.

That is; regardless the the timezone, getTimestamp() should return the same
value 
for any date. In most cases it does, but not on daylight-saving-time (DST)

transitions.

I have create a short script that illustrates the problem.

Test script:
---------------
$date1 = new DateTime("@1351382400"); // Sun Oct 28 2012 02:00:00 GMT+2
(DST)
var_dump($date1->getTimestamp()); //prints: 1351382400
$date1->setTimezone(new DateTimeZone("Europe/Stockholm"););
var_dump($date1->getTimestamp()); //prints: 1351386000


-- 
Edit bug report at https://bugs.php.net/bug.php?id=63459&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=63459&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=63459&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=63459&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=63459&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=63459&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=63459&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=63459&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=63459&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=63459&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=63459&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=63459&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=63459&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=63459&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63459&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=63459&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=63459&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=63459&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63459&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=63459&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=63459&r=mysqlcfg

Reply via email to