|  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
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:
Solve the problem:
39 - 16 = ?
Subscribe to this entry?

 [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-2020 The PHP Group
All rights reserved.
Last updated: Sat Jan 18 11:01:24 2020 UTC