|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-04-22 19:18 UTC] requinix@php.net
-Status: Open
+Status: Feedback
[2016-04-22 19:18 UTC] requinix@php.net
[2016-04-22 19:37 UTC] matheusmalves at gmail dot com
-Status: Feedback
+Status: Open
[2016-04-22 19:37 UTC] matheusmalves at gmail dot com
[2016-04-22 19:40 UTC] matheusmalves at gmail dot com
[2016-04-26 17:56 UTC] cmb@php.net
-Status: Open
+Status: Feedback
[2016-04-26 17:56 UTC] cmb@php.net
[2016-05-08 04:22 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 04:00:01 2025 UTC |
Description: ------------ When I create an object (DateTime), the second parameter (timezone) is ignored and uses UTC. The test script has a comparison with PHP 5.6. Test script: --------------- <?php date_default_timezone_set('UTC'); $dt = new DateTime('2016-04-22 17:00:00', new DateTimeZone('America/Sao_Paulo')); echo $dt->getTimestamp(); // Result: // 1461355200 (PHP 5.6.19) -> 04/22/2016 20:00 (UTC) // 1461344400 (PHP 7.0.5) -> 04/22/2016 17:00 (UTC) echo '<br />'; $dt = new DateTime('2016-04-22 20:00:00', new DateTimeZone('UTC')); $dt->setTimezone(new DateTimeZone('America/Sao_Paulo')); echo $dt->getTimestamp(); // Result: // 1461355200 (PHP 5.6.19) -> 04/22/2016 20:00 (UTC) // 1461355200 (PHP 7.0.5) -> 04/22/2016 20:00 (UTC) Expected result: ---------------- 1461355200 1461355200 Actual result: -------------- 1461344400 1461355200