Create DateTime from custom format

suggest change

PHP is able to parse a number of date formats. If you want to parse a non-standard format, or if you want your code to explicitly state the format to be used, then you can use the static DateTime::createFromFormat method:

Object oriented style

$format = "Y,m,d";
$time = "2009,2,26";
$date = DateTime::createFromFormat($format, $time);

Procedural style

$format = "Y,m,d";
$time = "2009,2,26";
$date = date_create_from_format($format, $time);

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents