php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #65189 Result from DateInterval->Format Should be Equivalent to Total Diff Value
Submitted: 2013-07-03 03:58 UTC Modified: 2013-07-03 16:07 UTC
From: femi at vsinstitute dot com Assigned:
Status: Duplicate Package: Date/time related
PHP Version: 5.3Git-2013-07-03 (Git) OS: ubuntu3.5
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: femi at vsinstitute dot com
New email:
PHP Version: OS:

 

 [2013-07-03 03:58 UTC] femi at vsinstitute dot com
Description:
------------
---
From manual page: http://www.php.net/dateinterval.format#refsect1-
dateinterval.format-description
---
Code:
echo date_diff(date_create('1970-00-00 00:00:00'), date_create())->format('%s');

Expected Output:
- A big number (at least 1372823738)

Current Output:
- A number less than 60

The value of the output should add up to the smaller date in date diff to 
produce the larger date. Or at least approximately. Since I am only including s 
in the format, the reported value for s should be exactly equal to the Unix 
timestamp.

Test script:
---------------
echo date_diff(date_create('1970-00-00 00:00:00'), date_create())->format('%s');

Expected result:
----------------
A big number (at least 1372823738)

Actual result:
--------------
A number less than 60

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-07-03 16:07 UTC] aharvey@php.net
-Status: Open +Status: Duplicate -Package: Class/Object related +Package: Date/time related
 [2013-07-03 16:07 UTC] aharvey@php.net
Duplicate of request #50075.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 10 08:01:27 2024 UTC