|  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
 [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-2019 The PHP Group
All rights reserved.
Last updated: Wed Sep 18 09:01:27 2019 UTC