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
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: abhilashdas at gmail dot com
New email:
PHP Version: OS:

 

 [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-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 05:01:31 2024 UTC