Bug #67302 [Opn->Dup]: DateTime->setTimezone does not set TZ correctly

From: Date: Wed, 29 Jun 2016 12:11:01 +0000
Subject: Bug #67302 [Opn->Dup]: DateTime->setTimezone does not set TZ correctly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-201904@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67302&edit=1 ID: 67302 Updated by: cmb@php.net Reported by: alan at bulbstudios dot com Summary: DateTime->setTimezone does not set TZ correctly -Status: Open +Status: Duplicate Type: Bug Package: Date/time related Operating System: OSX, Debian GNU/Linux PHP Version: 5.5.12 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Duplicate of bug #67077. Previous Comments: ------------------------------------------------------------------------ [2014-05-23 08:00:05] arjen at react dot com Already reported in https://bugs.php.net/bug.php?id=67077 ------------------------------------------------------------------------ [2014-05-20 11:24:26] arjen at react dot com DateTimeZone objects cannot be constructed by passing a timezone abbreviation anymore since 5.5.10: http://3v4l.org/Ui5ab#v5510 Probably broken by https://bugs.php.net/bug.php?id=45543 ------------------------------------------------------------------------ [2014-05-19 15:02:35] alan at bulbstudios dot com Another test case that shows the time is preserved when using a cloned DateTime, and also that the DateTimeZone offsets appear to be causing issues: http://3v4l.org/QpJYP ------------------------------------------------------------------------ [2014-05-19 14:12:28] alan at bulbstudios dot com A multi-version test case is available at: http://3v4l.org/mvReq ------------------------------------------------------------------------ [2014-05-19 12:24:05] alan at bulbstudios dot com The test script is actually: #!/usr/bin/env php <?php date_default_timezone_set('UTC'); echo date_default_timezone_get(), PHP_EOL; $utc = new DateTimeZone('UTC'); $time = DateTime::createFromFormat('Y-m-d H:i:s', '2014-05-19 11:30:00'); foreach (['BST', 'Etc/GMT+1', 'GMT+1', 'CEST'] as $abbr) { $time->setTimezone(new DateTimeZone($abbr)); echo "{$abbr}: {$time->format(DATE_RFC822)}", PHP_EOL; } ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=67302 -- Edit this bug report at https://bugs.php.net/bug.php?id=67302&edit=1

« previous php.bugs (#201904) next »