Bug #74524 [Opn]: Date diff is bad calculated, in same time zone

From: Date: Sat, 06 May 2017 19:02:47 +0000
Subject: Bug #74524 [Opn]: Date diff is bad calculated, in same time zone
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-208978@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: heiglandreas@php.net Reported by: kalita dot michal at gmail dot com Summary: Date diff is bad calculated, in same time zone Status: Open Type: Bug Package: Date/time related Operating System: Linux PHP Version: 7.1.4 Block user comment: N Private report: N New Comment: 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! Previous Comments: ------------------------------------------------------------------------ [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 ------------------------------------------------------------------------ [2017-05-02 20:06:40] andrew dot nester dot dev at gmail dot com Thanks Derick! gonna rework my pull request ------------------------------------------------------------------------ [2017-05-02 12:33:58] derick@php.net Andrew, it might look fixed for you because you have a different timezone with different DST rules configured. ------------------------------------------------------------------------ [2017-05-02 12:22:20] andrew dot nester dot dev at gmail dot com thanks for reporting the issue! I've been trying to reproduce it on latest PHP7.1 version (7.1.6-dev) and seems it's fixed already. Anyway, I've added test to check that it works (see my PR) ------------------------------------------------------------------------ [2017-05-01 20:59:31] kalita dot michal at gmail dot com Description: ------------ Calculated diff is 7 months, 14 days and -1 hour. It doen't make sense, why it is not 7 months, 13 days and 23 hours. This bug is in versions 5.4.45, 5.6.30, 7 and newest. (https://3v4l.org/6OOuG) Test script: --------------- $a = new DateTime("2017-11-17 22:05:26.000000"); $b = new DateTime("2017-04-03 22:29:15.079459"); $diff = $a->diff($b); return $diff->h; Expected result: ---------------- 23 Actual result: -------------- -1 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=74524&edit=1

« previous php.bugs (#208978) next »