Home  >  Article  >  Backend Development  >  Constants for the newly added date function in PHP 5_PHP Tutorial

Constants for the newly added date function in PHP 5_PHP Tutorial

WBOY
WBOYOriginal
2016-07-15 13:24:28892browse

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]


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446777.htmlTechArticlePHP 5.1.1 onwards defines the following constants 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...
Statement:
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