PHP 7.0.6 Released

Supported Date and Time Formats

Table of Contents

This section describes all the different formats that the strtotime(), DateTime and date_create() parser understands. The formats are grouped by section. In most cases formats from different sections can be used in the same date/time string. For each of the supported formats, one or more examples are given, as well as a description for the format. Characters in single quotes in the formats are case-insensitive ('t' could be t or T), characters in double quotes are case-sensitive ("T" is only T).

User Contributed Notes

PRETTYGIRL NOT COMe
2 years ago
I am afraid that there are some misleading expressions in this chapter "Supported Date and Time Formats".

eg.
(i) "MM & II" in "Time Formats" express "minutes & seconds" whereas "II & SS" often do the same in other places --- to avoid mistaking "M of minites" for "M of month".

(ii) The Format for "doy" in "Compound Formats" does not allow "000" shown in the Example.

(iii) "M / MM" in Table "Localized Notations" in "Compound Formats" are used for "month" whereas "MM" allows 00-59 according to the Table "Used Symbols".
To Top