Bug #63459 [Com]: getTimestamp() affected by setTimezone() on DST transition

From: Date: Fri, 24 May 2013 12:09:54 +0000
Subject: Bug #63459 [Com]: getTimestamp() affected by setTimezone() on DST transition
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-179117@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63459&edit=1 ID: 63459 Comment by: ryan dot scudellari at bronto dot com Reported by: luttkens at gmail dot com Summary: getTimestamp() affected by setTimezone() on DST transition Status: Open Type: Bug Package: Date/time related Operating System: Any PHP Version: 5.4.7RC1 Block user comment: N Private report: N New Comment: I too have run into this issue with PHP versions 5.3.23 and 5.3.6 Previous Comments: ------------------------------------------------------------------------ [2012-11-07 21:12:28] luttkens at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=63459&edit=1

« previous php.bugs (#179117) next »