| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull Requests
Pull requests: 
 HistoryAllCommentsChangesGit/SVN commits             
             [2014-08-11 12:03 UTC] ppasindud at gmail dot com
  [2021-04-06 19:52 UTC] derick@php.net
 
-Status:      Open
+Status:      Closed
-Assigned To:
+Assigned To: derick
  [2021-04-06 19:52 UTC] derick@php.net
  | 
    |||||||||||||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 14:00:01 2025 UTC | 
Description: ------------ DateTime::diff return wrong result for first day of month. Tested on PHP Version 5.4.10 \ 5.4.15 Test script: --------------- <?php date_default_timezone_set('Europe/Moscow'); $datetime1 = new DateTime('13-03-01'); $datetime2 = new DateTime('13-04-01'); $datetime3 = new DateTime('13-03-02'); $datetime4 = new DateTime('13-04-02'); $interval = $datetime2->diff($datetime1); echo $interval->format('%m month, %d days'), '<br>'; //1 month, 3 days $interval = $datetime4->diff($datetime3); echo $interval->format('%m month, %d days'); //1 month, 0 days Expected result: ---------------- 1 month, 0 days 1 month, 0 days Actual result: -------------- 1 month, 3 days 1 month, 0 days