Unrecognized characters in the format string will cause the
parsing to fail and an error message is appended to the returned
structure. You can query error messages with
DateTime::getLastErrors().

If format does not contain the character
! then portions of the generated time which are not
specified in format will be set to the current
system time.

If format contains the
character !, then portions of the generated
time not provided in format, as well as
values to the left-hand side of the !, will
be set to corresponding values from the Unix epoch.

Say if there is a string with $date = "today is 2014 January 1"; and you need to extract "2014 January" using DateTime::createFromFormat(). As you can see in the string there is something odd like "today is" .Since that string (today is) does not correspond to a date format, we need to escape that.

In this case, each and every character on that string has to be escaped as shown below.

This gets hairy when you are playing with transition from summer time to winter time! For instance, in Toronto, the time change happens on 2011-11-06. One second after 01:59:59 (EDT), the time becomes 01:00:00 (EST), or 1320559200 in Unix timestamp.

In order to use a DateTimeZone, don't enter one of the DateTimeZone::Europe, DateTimeZone::Asia etc. constants, but create a DateTimeZone object with verbal timezone name passed as a string:<?php$eventDate = DateTime::createFromFormat('m/d/y h:i', '02/26/11 08:00', new DateTimeZone('Europe/Warsaw'));echo date_format($eventDate, 'Y-m-d'); //prints "2011-02-26"

I've found that on PHP 5.5.13 (not sure if it happens on other versions) if you enter a month larger than 12 on a format that takes numeric months, the result will be a DateTime object with its month equal to the number modulo 12 instead of returning false.