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
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 !
Your email address:
MUST BE VALID
Solve the problem:
49 - 16 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Fri Mar 29 15:01:28 2024 UTC