|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65101 DateInterval is using 'm' for minutes when it should be 'i'
Submitted: 2013-06-23 07:10 UTC Modified: 2013-07-31 01:47 UTC
From: vonhara at gmail dot com Assigned:
Status: Not a bug Package: date_time (PECL)
PHP Version: 5.4.16 OS: CentOS 6.4 (64bit)
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.
Block user comment
Status: Assign to:
Bug Type:
From: vonhara at gmail dot com
New email:
PHP Version: OS:


 [2013-06-23 07:10 UTC] vonhara at gmail dot com
Either manual page ( or DateInterval is broken somehow.

I have understood that charected 'i' means minutes, not like 'm' (like in example). This will produce an error and is hard to handle simple ways is 'm' is used BOTH months and minutes.

Test script:
# Works
$date = new \DateTime();
$date->add(new \DateInterval('P2Y1M4DT6H8M'));

# Not working
$date = new \DateTime();
$date->add(new \DateInterval('P2Y1M4DT6H8I'));

Expected result:
Returning the current day plus interval.

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-06-25 21:57 UTC] david at nnucomputerwhiz dot com
The manual page you liked to is for the format function which you are not using. 
The contructor manual page does not list the 'I' option so the program is 
behaving correctly. In this case M is used for month and minute because they can 
always be distiguished because of the T seperating them.
 [2013-07-31 01:47 UTC]
-Status: Open +Status: Not a bug
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed May 12 03:01:24 2021 UTC