Home > Backend Development > PHP Tutorial > Constants for the newly added date function in PHP5_PHP Tutorial

Constants for the newly added date function in PHP5_PHP Tutorial

WBOY
Release: 2016-07-13 17:29:40
Original
891 people have browsed it

After php5.1.1, the date function adds the following constants.

Since 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 (eg: 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);


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/531670.htmlTechArticleAfter php5.1.1, the date function adds the following constants. The following constants are defined since PHP 5.1.1 to provide standard date expressions that can be used with date format functions (such as date()). D...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template