the_date_xml()
云策文档标注
概述
the_date_xml() 函数用于输出 ISO 8601 格式的日期,特别适用于 XML 文件。它基于当前文章的发布日期生成日期字符串。
关键要点
- 输出 ISO 8601 格式(Y-m-d)的日期,常用于 XML 文件
- 内部调用 mysql2date() 和 get_post() 函数来获取和格式化日期
- 自 WordPress 1.0.0 版本引入,无后续变更记录
代码示例
function the_date_xml() {
echo mysql2date( 'Y-m-d', get_post()->post_date, false );
}
原文内容
Outputs the date in iso8601 format for xml files.
Source
function the_date_xml() {
echo mysql2date( 'Y-m-d', get_post()->post_date, false );
}
Changelog
| Version | Description |
|---|---|
| 1.0.0 | Introduced. |
Skip to note 2 content
Codex
Outputs the date in iso8601 format (especially used for XML files)
<p>Date posted: </p>