php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #64767 DateInterval::format Inconsistant
Submitted: 2013-05-03 00:03 UTC Modified: 2021-01-13 15:02 UTC
From: brent dot hansen at gmail dot com Assigned:
Status: Suspended Package: Date/time related
PHP Version: Irrelevant OS: All
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:
1 + 22 = ?
Subscribe to this entry?

 
 [2013-05-03 00:03 UTC] brent dot hansen at gmail dot com
Description:
------------
DateInterval::format() does not follow standard like DateTime & Date. Need to use 
new format.  What used to be H:i:s for formatting now needs H:I:S





Test script:
---------------
$interval = new DateInterval('P2Y4DT6H8M');

echo $interval->format("%Y-%m-%d %H:%i:%s");

Expected result:
----------------
02-00-04 06:08:00

Actual result:
--------------
02-0-4 06:8:0

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-05-03 18:07 UTC] brent dot hansen at gmail dot com
Changing to request instead of bug.
 [2013-05-03 18:07 UTC] brent dot hansen at gmail dot com
-Type: Bug +Type: Feature/Change Request
 [2021-01-13 15:02 UTC] cmb@php.net
-Status: Open +Status: Suspended
 [2021-01-13 15:02 UTC] cmb@php.net
I don't think that this can be changed for BC reasons.  If you
feel strongly that it should be done nonetheless, please pursue
the RFC process[1].  For the time being, I'm suspending this
ticket.

[1] <https://wiki.php.net/rfc/howto>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 05:01:28 2024 UTC