Home >Backend Development >PHP Tutorial >Newly added constants for date function in PHP5 program_PHP Tutorial

Newly added constants for date function in PHP5 program_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 10:28:00837browse

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);

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/814353.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+0...
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