|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64653 Subtraction of DateInterval yields wrong result.
Submitted: 2013-04-16 21:47 UTC Modified: 2016-06-14 10:53 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: eugen dot artus at gmx dot net Assigned:
Status: Verified Package: Date/time related
PHP Version: 5.4.14 OS: Kubuntu 12.04
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: eugen dot artus at gmx dot net
New email:
PHP Version: OS:


 [2013-04-16 21:47 UTC] eugen dot artus at gmx dot net
The test script below prints '2370-01-00' as the result, which is obviously wrong.

Test script:
    $date = new \DateTime('2370-01-31');
    echo $date->sub(new \DateInterval('P1M'))->format('Y-m-d'); 

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-14 10:53 UTC]
-Status: Open +Status: Verified
 [2016-06-14 10:53 UTC]
Verified: <>
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC