Bug #64653 [Opn->Ver]: Subtraction of DateInterval yields wrong result.

From: Date: Tue, 14 Jun 2016 10:53:25 +0000
Subject: Bug #64653 [Opn->Ver]: Subtraction of DateInterval yields wrong result.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-201594@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=64653&edit=1

 ID:                 64653
 Updated by:         cmb@php.net
 Reported by:        eugen dot artus at gmx dot net
 Summary:            Subtraction of DateInterval yields wrong result.
-Status:             Open
+Status:             Verified
 Type:               Bug
 Package:            Date/time related
 Operating System:   Kubuntu 12.04
 PHP Version:        5.4.14
 Block user comment: N
 Private report:     N

 New Comment:

Verified: <https://3v4l.org/LpEF6>


Previous Comments:
------------------------------------------------------------------------
[2013-04-16 21:47:25] eugen dot artus at gmx dot net

Description:
------------
The test script below prints '2370-01-00' as the result, which is obviously wrong.

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


Expected result:
----------------
2369-12-31

Actual result:
--------------
2370-01-00


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=64653&edit=1


Thread (3 messages)

« previous php.bugs (#201594) next »