note 129165 added to datetimeimmutable.createfromformat

From: Date: Tue, 16 Jan 2024 12:20:07 +0000
Subject: note 129165 added to datetimeimmutable.createfromformat
Groups: php.notes 
Request: Send a blank email to php-notes+get-221119@lists.php.net to get a copy of this message
If you are not happy with wide range of conversions and repairs this method is making for you, or just want to check that date is really same as input: ``` $datetime = \DateTimeImmutable::createFromFormat('Y-m-d G:i:s', $userDateTimeInput); if ($datetime && $datetime->format('Y-m-d G:i:s') === $userDateTimeInput) { // $datetime is not false and we have a correct date in correct format from user } ``` ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.157.134 (proxied: 2a05:87c7:9002:e400:7be8:b76c:8ee3:5a39) ---- Manual Page -- https://php.net/manual/en/datetimeimmutable.createfromformat.php Edit -- https://main.php.net/note/edit/129165 Del: integrated -- https://main.php.net/note/delete/129165/integrated Del: useless -- https://main.php.net/note/delete/129165/useless Del: bad code -- https://main.php.net/note/delete/129165/bad+code Del: spam -- https://main.php.net/note/delete/129165/spam Del: non-english -- https://main.php.net/note/delete/129165/non-english Del: in docs -- https://main.php.net/note/delete/129165/in+docs Del: other reasons-- https://main.php.net/note/delete/129165 Reject -- https://main.php.net/note/reject/129165 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221119) next »