|  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
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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: an0nym at narod dot ru
New email:
PHP Version: OS:


 [2011-01-29 23:42 UTC] an0nym at narod dot ru
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:
$d = new DateTime("2011-01-01");
echo $d->diff(new DateTime("2010-01-01"))->format("%a");

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-30 10:53 UTC]
-Status: Open +Status: Feedback
 [2011-01-30 10:53 UTC]
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]
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: danielc
 [2011-11-21 03:01 UTC]
This is a duplicate of
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Mar 03 09:01:23 2021 UTC