DateTime::createFromFormat

PHP 5 >= 5.3.0, PHP 7, PHP 8
DateTime::createFromFormat - Parses a time string according to a specified format
Manual
Code Examples

Example #1 Intricacies of DateTime::createFromFormat

Result: Current time: 2010-04-23 10:29:35 Format: Y-m-d; 2009-02-15 10:29:35 Format: Y-m-d H:i:s; 2009-02-15 15:16:17 Format: Y-m-!d H:i:s; 1970-01-15 15:16:17 Format: !d; 1970-01-15 00:00:00
PHP Version:

Example #2 DateTime::createFromFormat example

Result: 2009-02-15
PHP Version:

Example #3 Format string with literal characters

Result: 23:15:03
PHP Version:


Function DateTime::createFromFormat:

Date and Time Functions

Most used PHP functions