php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53880 date_diff returns wrong results
Submitted: 2011-01-29 23:42 UTC Modified: 2011-11-21 03:01 UTC
Votes:4
Avg. Score:4.5 ± 0.5
Reproduced:4 of 4 (100.0%)
Same Version:3 (75.0%)
Same OS:0 (0.0%)
From: an0nym at narod dot ru Assigned: danielc (profile)
Status: Duplicate Package: Date/time related
PHP Version: 5.3.5 OS: Windows Server 2008 R2 x64
Private report: No CVE-ID: None
 [2011-01-29 23:42 UTC] an0nym at narod dot ru
Description:
------------
See test script. 

On FreeBSD 8.1-RELEASE-p1 amd64, Linux 2.6.18-194.32.1.el5 x86_64, Windows 7 x64 
everything works fine. 

Test script:
---------------
date_default_timezone_set("UTC");
$d = new DateTime("2011-01-01");
echo $d->diff(new DateTime("2010-01-01"))->format("%a");

Expected result:
----------------
365

Actual result:
--------------
6015

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-30 10:53 UTC] stas@php.net
-Status: Open +Status: Feedback
 [2011-01-30 10:53 UTC] stas@php.net
Works fine for me on XP 32-bit with VC9. Which compiler/build did you use?
 [2011-01-30 15:09 UTC] an0nym at narod dot ru
-Status: Feedback +Status: Open
 [2011-01-30 15:09 UTC] an0nym at narod dot ru
I didn't compile myself. I downloaded VC6 x86 thread safe from windows binaries 
php download page.
 [2011-01-30 15:12 UTC] an0nym at narod dot ru
Pay attention to the end of description. Windows 7 x64 doesn't have this bug, 
while Windows Server 2008 R2 do and they have much more simiral codebase than 
Windows XP and Windows Server 2008 R2.
 [2011-05-08 11:48 UTC] eikcam at internode dot on dot net
I'm running Windows 7 64-bit and I am having this issue. 

DateInterval Object ( [y] => 0 [m] => 1 [d] => 30 [h] => 0 [i] => 0 [s] => 0 [invert] => 0 [days] => 6015 )
 [2011-11-21 03:01 UTC] danielc@php.net
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: danielc
 [2011-11-21 03:01 UTC] danielc@php.net
This is a duplicate of http://bugs.php.net/bug.php?id=51184
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC