Home > php教程 > php手册 > body text

PHP5中新增加的日期(date)函数的常量

WBOY
Release: 2016-06-13 10:29:12
Original
817 people have browsed it

php5.1.1以后,date函数新增了以下常量。

自 PHP 5.1.1 起定义有以下常量来提供标准日期表达方法,可以用于日期格式函数(例如 date())。

DATE_ATOM(string)
原子钟格式(如:2005-08-15T15:52:01+00:00)

DATE_COOKIE(string)
HTTP Cookies 格式(如:Mon, 15 Aug 2005 15:52:01 UTC)

DATE_ISO8601(string)
ISO-8601(如:2005-08-15T15:52:01+0000)

DATE_RFC822(string)
RFC 822(如:Mon, 15 Aug 2005 15:52:01 UTC)

DATE_RFC850(string)
RFC 850(如:Monday, 15-Aug-05 15:52:01 UTC)

DATE_RFC1036(string)
RFC 1036(如:Monday, 15-Aug-05 15:52:01 UTC)

DATE_RFC1123(string)
RFC 1123(如:Mon, 15 Aug 2005 15:52:01 UTC)

DATE_RFC2822(string)
RFC 2822(如:Mon, 15 Aug 2005 15:52:01 +0000)

DATE_RSS(string)
RSS(如:Mon, 15 Aug 2005 15:52:01 UTC)

DATE_W3C(string)
World Wide Web Consortium(如:2005-08-15T15:52:01+00:00)

比如,要输出一个RSS需要的日期格式,就可以用下面的代码简单实现:

echo date(DATE_RSS);


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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!