php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #62626 not showing proper value
Submitted: 2012-07-21 04:39 UTC Modified: 2013-02-18 00:35 UTC
From: abhilashdas at gmail dot com Assigned:
Status: No Feedback Package: Date/time related
PHP Version: 5.4.5 OS: win 7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
45 + 31 = ?
Subscribe to this entry?

 
 [2012-07-21 04:39 UTC] abhilashdas at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/datetime.diff#refsect1-datetime.diff-
returnvalues
---

$datetime1 = date_create('2009-10-11');
$datetime2 = date_create('2009-10-13');
$interval = date_diff($datetime1, $datetime2);
echo $interval->format('%R%a days');

This is suppose to give me +2 as out put. But I am getting +6015 day.

Not sure it is a bug or some setting problem.
My machine is win7 and timezone is +5:30


Test script:
---------------
$datetime1 = date_create('2009-10-11');
$datetime2 = date_create('2009-10-13');
$interval = date_diff($datetime1, $datetime2);
echo $interval->format('%R%a days');

Expected result:
----------------
+2 days

Actual result:
--------------
+6015 days

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-07-23 13:27 UTC] fa@php.net
-Status: Open +Status: Feedback
 [2012-07-23 13:27 UTC] fa@php.net
Works for me on 5.4.5/Debian.

Have you set your timezone? e.g. with 

date_default_timezone_set("Europe/Berlin");
 [2013-02-18 00:35 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Dec 04 08:03:38 2021 UTC