Home >Backend Development >PHP Tutorial >Constants for the newly added date function in PHP 5_PHP Tutorial
The following constants are defined since PHP 5.1.1 to provide standard date expression methods, which can be used in date format functions (such as date()).
DATE_ATOM(string)
Atomic clock format (such as: 2005-08-15T15:52:01+00:00)
DATE_COOKIE(string)
HTTP Cookies format (eg: Mon, 15 Aug 2005 15:52:01 UTC)
DATE_ISO8601(string)
ISO-8601 (eg: 2005-08-15T15:52:01 +0000)
DATE_RFC822(string)
RFC 822 (eg: Mon, 15 Aug 2005 15:52:01 UTC)
DATE_RFC850(string)
RFC 850 (eg: Monday, 15-Aug-05 15:52:01 UTC)
DATE_RFC1036(string)
RFC 1036 (eg: Monday, 15-Aug-05 15 :52:01 UTC)
DATE_RFC1123(string)
RFC 1123(such as: Mon, 15 Aug 2005 15:52:01 UTC)
DATE_RFC2822(string)
RFC 2822 (eg: Mon, 15 Aug 2005 15:52:01 +0000)
DATE_RSS(string)
RSS (eg: Mon, 15 Aug 2005 15: 52:01 UTC)
DATE_W3C(string)
World Wide Web Consortium (such as: 2005-08-15T15:52:01+00:00)
For example, To output the date format required by RSS, you can simply use the following code to achieve it:
<p>echo date(DATE_RSS);</p> |
[Related articles]