当前浏览:首页 / WordPress函数 / get_post_time()

get_post_time( string $format = 'U', bool $gmt = false, int|WP_Post $post = null, bool $translate = false )

检索撰写文章的时间

postmore...

timemore...


参数

$format

(string) (可选) 用于检索文章撰写时间的格式。接受“G”、“U”或PHP日期格式。

默认值: 'U'

$gmt

(bool) (可选) 是否检索GMT时间。

默认值: false

$post

(int|WP_Post) (可选) WP_Post对象或ID。默认值为全局$post对象。

默认值: null

$translate

(bool) (可选) 是否转换时间字符串。

默认值: false


返回

(string|int|false) 如果$format是“U”或“G”,则为格式化的日期字符串或Unix时间戳。失败时为False。



源码

查看源码 官方文档


更新日志

版本描述
2.0.0开始引入