Date FormatsThis page describes the different date formats in a BNF-like syntax, that the DateTimeImmutable, DateTime, date_create, date_create_immutable, and strtotime parser understands. To format DateTimeImmutable and DateTime objects, please refer to the documentation of the DateTimeInterface::format method.
Caution
It is possible to over- and underflow the Note that the day range is restricted to 0-31 as indicated by the regular expression above. Thus "2008-06-32" is not a valid date string, for instance.
It is also possible to underflow the If you combine the previous two facts and underflow both the day and the month, the following happens: "2008-00-00" first gets converted to "2007-12-00" which then gets converted to "2007-11-30". This also happens with the string "0000-00-00", which gets transformed into "-0001-11-30" (the year -1 in the ISO 8601 calendar, which is 2 BC in the proleptic Gregorian calendar). |