Bug #62326 [Opn]: date_diff() function returns false result
| From: | rasmus@php.net | Date: | Thu, 14 Jun 2012 19:00:49 +0000 |
| Subject: | Bug #62326 [Opn]: date_diff() function returns false result | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-171260@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62326&edit=1
ID: 62326
Updated by: rasmus@php.net
Reported by: ploeger dot private at googlemail dot com
Summary: date_diff() function returns false result
Status: Open
Type: Bug
Package: Class/Object related
Operating System: Windows Server 2008 R2
PHP Version: 5.3Git-2012-06-14 (snap)
Block user comment: N
Private report: N
New Comment:
That output 06 on Linux
Previous Comments:
------------------------------------------------------------------------
[2012-06-14 18:52:28] ploeger dot private at googlemail dot com
Description:
------------
The source code will return 05 instead of 06.
If you change the day to 02 instead of 01 in start_timestamp and end_timestamp
everything seems to work correct.
Debug:
print_r($start_timestamp);
Result: DateTime Object ( [date] => 2012-06-01 00:00:00 [timezone_type] => 3
[timezone] => Europe/Berlin )
print_r($end_timestamp);
Result: DateTime Object ( [date] => 2012-12-01 00:00:00 [timezone_type] => 3
[timezone] => Europe/Berlin )
Test script:
---------------
$start_timestamp = date_create('2012-06-01');
$end_timestamp = date_create('2012-12-01');
$difference = date_diff($start_timestamp, $end_timestamp);
$difference = $difference->format('%M');
Expected result:
----------------
06
Actual result:
--------------
05
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62326&edit=1