(PHP 5 >= 5.3.0, PHP 7, PHP 8)
DateTime::createFromFormat -- date_create_from_format — Parses a time string according to a specified format
Object-oriented style
$format
$datetime
$timezone
null
Procedural style
Returns a new DateTime object representing the date and time specified by the datetime string, which was formatted in the given format.
datetime
format
Like DateTimeImmutable::createFromFormat() and date_create_immutable_from_format(), respectively, but creates a DateTime object.
This method, including parameters, examples, and considerations are documented on the DateTimeImmutable::createFromFormat page.
See DateTimeImmutable::createFromFormat.
Returns a new DateTime instance or false on failure.
false
This method throws ValueError when the datetime contains NULL-bytes.
For an extensive set of examples, see DateTimeImmutable::createFromFormat.