note 127957 added to datetime.createfromformat

From: Date: Wed, 23 Nov 2022 15:54:52 +0000
Subject: note 127957 added to datetime.createfromformat
Groups: php.notes 
Request: Send a blank email to php-notes+get-219912@lists.php.net to get a copy of this message
Interesting to note that DateTime::createFromFormat('Y-m-d', $date) can result in a valid date from an incorrect date input. For instance if the $date = '2021-23-23' (an invalid date), the output from this would be '2022-11-23'. Not sure what the internal logic is. I was hoping for a false return. Seems like it could be setting month to 00, and then adding 23 months to get to 2022-11-23. ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.159.161 (proxied: 105.224.32.44) ---- Manual Page -- https://php.net/manual/en/datetime.createfromformat.php Edit -- https://main.php.net/note/edit/127957 Del: integrated -- https://main.php.net/note/delete/127957/integrated Del: useless -- https://main.php.net/note/delete/127957/useless Del: bad code -- https://main.php.net/note/delete/127957/bad+code Del: spam -- https://main.php.net/note/delete/127957/spam Del: non-english -- https://main.php.net/note/delete/127957/non-english Del: in docs -- https://main.php.net/note/delete/127957/in+docs Del: other reasons-- https://main.php.net/note/delete/127957 Reject -- https://main.php.net/note/reject/127957 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#219912) next »