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

From: Date: Tue, 02 May 2017 12:34:00 +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-208910@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 Type: Bug Package: Date/time related Operating System: Linux PHP Version: 7.1.4 Block user comment: N Private report: N New Comment: Andrew, it might look fixed for you because you have a different timezone with different DST rules configured. Previous Comments: ------------------------------------------------------------------------ [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 (#208910) next »