Bug #66485 [Com]: 01.01.2014 diff 01.02.2014 is 30 days instead of 1 month
| From: | jimmy dot gaussen at gmail dot com | Date: | Mon, 09 Nov 2015 08:23:30 +0000 |
| Subject: | Bug #66485 [Com]: 01.01.2014 diff 01.02.2014 is 30 days instead of 1 month | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-197128@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66485&edit=1
ID: 66485
Comment by: jimmy dot gaussen at gmail dot com
Reported by: kuba at pdesign dot pl
Summary: 01.01.2014 diff 01.02.2014 is 30 days instead of 1
month
Status: Assigned
Type: Bug
Package: Date/time related
Operating System: Windows 7
PHP Version: 5.5.8
Assigned To: derick
Block user comment: N
Private report: N
New Comment:
Hi,
I had the same issue on 5.6.10, on Linux and Winndows. I tried to do some research on it, here is
the dead r/PHPHelp thread I opened:
https://www.reddit.com/r/PHPhelp/comments/3r7so6/weird_datetimediff_interaction_with_time_zones/
Previous Comments:
------------------------------------------------------------------------
[2014-01-14 12:44:58] kuba at pdesign dot pl
Description:
------------
---
From manual page: http://www.php.net/datetime.diff
---
see the actual result
Test script:
---------------
// date format DD-MM-YYYY
$start = new DateTime('01-02-2014');
$stop = new DateTime('01-03-2014');
$diff = $start->diff($stop);
echo $diff->format('%d days %m months');
Expected result:
----------------
0 days 1 months
Actual result:
--------------
28 days 0 months
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66485&edit=1