Bug #74524 [Opn->Csd]: Date diff is bad calculated, in same time zone
| From: | derick@php.net | Date: | Tue, 06 Apr 2021 19:54:41 +0000 |
| Subject: | Bug #74524 [Opn->Csd]: Date diff is bad calculated, in same time zone | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-233259@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74524&edit=1
ID: 74524
Updated by: derick@php.net
Reported by: kalita dot michal at gmail dot com
Summary: Date diff is bad calculated, in same time zone
-Status: Open
+Status: Closed
Type: Bug
Package: Date/time related
Operating System: Linux
PHP Version: 7.1.4
-Assigned To:
+Assigned To: derick
Block user comment: N
Private report: N
New Comment:
The fix for this bug has been committed.
If you are still experiencing this bug, try to check out latest source from https://github.com/php/php-src and re-test.
Thank you for the report, and for helping us make PHP better.
Fixed for PHP 8.1.
Previous Comments:
------------------------------------------------------------------------
[2020-10-22 08:54:34] steve dot caillault at gmail dot com
I a similar problem with the PHP version 7.4.7 :
$currentDateString = '2020-10-21 22:22:59';
$targetDateString = '2020-10-25 21:30:00';
$timezone = new \DateTimeZone('Europe/Paris');
$currentDateTime = new \DateTime($currentDateString, $timezone);
$targetDateTime = new \DateTime($targetDateString, $timezone);
$dateInterval = $currentDateTime->diff($targetDateTime, TRUE);
echo $dateInterval->h;
$dateInterval->h value is -1, while the value should be 23.
I have the problem on Windows and UNIX.
------------------------------------------------------------------------
[2017-12-01 16:46:19] miloslav dot hula at gmail dot com
Hi,
probably another example of bug: https://3v4l.org/S7rGP
In the Europe/Prague timezone, there was a 1 hour switch back on 29th Oct 2017 from 03:00 to 02:00
(from CEST to CET).
When run on 3v4l.org with EOL versions checked, you can notice that behaviour has been correct in
5.3.0-5.4.23, 5.5.0-5.5.7. In the PHP5 5.4.24 and 5.5.8 change log is fixed bug #66060
(https://bugs.php.net/bug.php?id=66060).
------------------------------------------------------------------------
[2017-10-30 11:26:08] onda204 at gmail dot com
Hi,
I detected the following issue that may have to do with present Bug.
Using diff with dates that are on range of summer / winter time change, the function diff on element
$interval->h gives result -1
Tested width date interval:
27-10-2017
15.00 H
29-10-2017
14.00 H
Portuguese regional settings
------------------------------------------------------------------------
[2017-05-06 19:02:46] heiglandreas@php.net
This is a DST issue as can be seen in https://3v4l.org/9AWOI
The default Timezone of 3v4l.org is Europe/Amsterdam which has DST and therefore has the issue!
------------------------------------------------------------------------
[2017-05-03 07:18:55] andrew dot nester dot dev at gmail dot com
Just added reworked pull request to this issue. Here is the link https://github.com/php/php-src/pull/2506
------------------------------------------------------------------------
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=74524
--
Edit this bug report at https://bugs.php.net/bug.php?id=74524&edit=1