|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-11-24 14:20 UTC] cmb@php.net
[2020-11-24 16:11 UTC] cmb@php.net
-Status: Open
+Status: Verified
[2020-11-24 16:11 UTC] cmb@php.net
[2021-01-02 01:13 UTC] simapple at qq dot com
[2022-05-13 13:36 UTC] derick@php.net
-Status: Verified
+Status: Closed
-Assigned To:
+Assigned To: derick
[2022-05-13 13:36 UTC] derick@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 14:00:01 2025 UTC |
Description: ------------ DateTime::modify() with parametrem 'weekday' loses time value. Also date() function. Test script: --------------- <?php $date = '2020-11-27 12:33:00'; echo date('Y-m-d H:i:s', strtotime($date.' +1 day')); // Correct: 2020-11-28 12:33:00 echo date('Y-m-d H:i:s', strtotime($date.' +1 Weekday')); // Uncorrect, lost time: 2020-11-30 00:00:00 $date1 = new DateTime($date); $date2 = new DateTime($date); $date2->modify('+1 day'); echo $date2->format('Y-m-d H:i:s'); // Correct: 2020-11-28 12:33:00 $date1->modify('+1 weekday'); echo $date1->format('Y-m-d H:i:s'); // Uncorrect, lost time: 2020-11-30 00:00:00