| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull Requests
Pull requests: 
 HistoryAllCommentsChangesGit/SVN commits             
             [2014-10-16 19:19 UTC] sjon at hortensius dot net
  [2019-10-06 22:15 UTC] aleh dot kashnikau at gmail dot com
  [2019-10-23 13:34 UTC] cmb@php.net
 
-Status:      Open
+Status:      Closed
-Assigned To:
+Assigned To: cmb
  [2019-10-23 13:34 UTC] cmb@php.net
  | 
    |||||||||||||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 07:00:01 2025 UTC | 
Description: ------------ calling getTimestamp() on an instance of a DateTimeImmutable modify it (and return the modified date timestamp). calling format('U') does not modify the date Test script: --------------- <?php $date = new DateTimeImmutable('2014-05'); $date2 = $date->modify('first day of next month midnight - 1 second'); var_dump($date2->format('c')); var_dump($date2->format('U')); var_dump($date2->format('c')); var_dump($date2->getTimestamp()); var_dump($date2->format('U')); var_dump($date2->format('c')); Expected result: ---------------- string(25) "2014-05-31T23:59:59+00:00" string(10) "1401580799" string(25) "2014-05-31T23:59:59+00:00" int(1401580799) string(10) "1401580799" string(25) "2014-05-31T23:59:59+00:00" Actual result: -------------- string(25) "2014-05-31T23:59:59+00:00" string(10) "1401580799" string(25) "2014-05-31T23:59:59+00:00" int(1398988799) string(10) "1398988799" string(25) "2014-05-01T23:59:59+00:00"