【发布时间】:2017-08-01 16:30:33
【问题描述】:
我的网站上有一个博客。在博客列表中,我想显示日期和时间。我用the_time() 获得发布的发布日期。但是获取时间是一个棘手的部分。
我不想显示发布时间,例如1:30 PM
我想显示帖子的持续时间......我的意思是这样
53 minutes ago
要么
4 hours ago
要么
2 days ago
要么
5 months ago
要么
1 year ago
我首先尝试此代码 get_post_time('U', $post->ID) 或 get_post_time('U', true) 但它给了我时间戳,就像这样 1486128075
也可以试试这个get_the_time(),但它给了我1:00 PM
希望你能理解我的问题
【问题讨论】:
-
为什么不自己计算呢?
-
尝试this并使用
get_the_time()函数。
标签: php wordpress datetime timestamp