|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-07-26 22:01 UTC] cmb@php.net
-Status: Open
+Status: Verified
[2021-07-26 22:01 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 09:00:01 2025 UTC |
Description: ------------ If you subtract timezones from the different sides of the standard/dst time boundary - the result is wrong. Test script: --------------- <?php $dt = new \DateTime('2018-04-01 03:10:00', new \DateTimeZone('Pacific/Auckland')); $dt2 = clone $dt; $dt2->sub(new \DateInterval('PT2H')); var_dump($dt > $dt2, $dt->format(\DateTime::RFC3339), $dt2->format(\DateTime::RFC3339), $dt->diff($dt2)->format('%h')); Expected result: ---------------- bool(true) string(25) "2018-04-01T03:10:00+12:00" string(25) "2018-04-01T02:10:00+13:00" string(1) "2" Actual result: -------------- bool(true) string(25) "2018-04-01T03:10:00+12:00" string(25) "2018-04-01T02:10:00+13:00" string(1) "1"