php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: vonhara at gmail dot com
New email:
PHP Version: OS:

 

 [2013-06-23 07:10 UTC] vonhara at gmail dot com
Description:
------------
Either manual page (http://www.php.net/manual/en/dateinterval.format.php) 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:
--------------
Error

Patches

Pull Requests

History

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. 
http://www.php.net/manual/en/dateinterval.construct.php
 [2013-07-31 01:47 UTC] yohgaki@php.net
-Status: Open +Status: Not a bug
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 21:01:35 2025 UTC