(PHP 5 >= 5.2.0, PHP 7)
Representation of date and time.
$format
, string $time
[, DateTimeZone $timezone
] )DateTime::ATOM
DATE_ATOM
DATE_COOKIE
DateTime::ISO8601
DATE_ISO8601
Note: This format is not compatible with ISO-8601, but is left this way for backward compatibility reasons. Use
DateTime::ATOM
orDATE_ATOM
for compatibility with ISO-8601 instead.
DateTime::RFC822
DATE_RFC822
DateTime::RFC850
DATE_RFC850
DateTime::RFC1036
DATE_RFC1036
DateTime::RFC1123
DATE_RFC1123
DateTime::RFC2822
DATE_RFC2822
DateTime::RFC3339
DATE_RFC3339
DATE_ATOM
(since PHP 5.1.3)
DateTime::RFC3339_EXTENDED
DATE_RFC3339_EXTENDED
DateTime::RSS
DATE_RSS
DateTime::W3C
DATE_W3C
版本 | 说明 |
---|---|
7.0.0 | Added constants: DATE_RFC3339_EXTENDED and DateTime::RFC3339_EXTENDED. |
5.5.0 | The class now implements DateTimeInterface. |
5.4.24 | The COOKIE constant was changed to reflect RFC 1036 using a four digit year rather than a two digit year (RFC 850) as prior versions. |
5.2.2 | DateTime object comparison with the comparison operators changed to work as expected. Previously, all DateTime objects were considered equal (using ==). |