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

From: Date: Mon, 20 Apr 2015 03:14:51 +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-192218@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: pasindu@php.net 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: http://3v4l.org/pts6t Previous Comments: ------------------------------------------------------------------------ [2014-01-14 00:38:56] jeremy at jcarnus dot fr Hello, I have the same problem with timestamp 1382833659 that return 1382837259 on php 5.4.4 Does a fix will be released ? Thanks ------------------------------------------------------------------------ [2013-05-24 12:09:54] ryan dot scudellari at bronto dot com I too have run into this issue with PHP versions 5.3.23 and 5.3.6 ------------------------------------------------------------------------ [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 (#192218) next »