最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

date - What are the "U" and "G" time formats?

programmeradmin2浏览0评论

In WordPress time functions, such as get_post_time(), one can pass a couple of formats that I do not understand what they do. Those are U and G. What are those exactly? Documentation is pretty vague.

Thanks.

In WordPress time functions, such as get_post_time(), one can pass a couple of formats that I do not understand what they do. Those are U and G. What are those exactly? Documentation is pretty vague.

Thanks.

Share Improve this question asked Mar 24, 2020 at 16:16 GreesoGreeso 2,2347 gold badges33 silver badges57 bronze badges 4
  • 1 This is not WP specific, here is the complete list: php/manual/en/function.date.php – disinfor Commented Mar 24, 2020 at 16:18
  • @disinfor - Ah, thank you. – Greeso Commented Mar 24, 2020 at 16:32
  • 1 @disinfor can you post that as an answer instead of a comment? – Tom J Nowell Commented Mar 24, 2020 at 16:57
  • 1 @TomJNowell Done and Done! – disinfor Commented Mar 24, 2020 at 17:01
Add a comment  | 

1 Answer 1

Reset to default 2

The U and G are not WordPress specific. get_post_time() is using the same datetime formats as the default PHP date method.

Here is the documentation for all of the formats: https://www.php/manual/en/function.date.php

Specific to the question:

U is Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)

G is 24-hour format of an hour without leading zeros. 0 through 24

发布评论

评论列表(0)

  1. 暂无评论