Home >Backend Development >PHP Tutorial >Newly added constants for date function in PHP5 program_PHP Tutorial
Starting from PHP 5.1.1, the following constants are defined 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 (such as: Mon, 15 Aug 2005 15:52:01 UTC)
DATE_ISO8601(string)
ISO-8601 (such as: 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 (eg: 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:
echo date(DATE_RSS);