更新时间:2023-02-26 16:11:58
从文档 date()
: H
格式字符以24小时格式给出小时。另外,如果您不想在中午之前的几个小时内领先 0
,则可以使用 G
。
From the docs for date()
: The H
format character gives the hour in 24h format. Also, you can use G
if you do not want the leading 0
for hours before noon.
示例(如果当前时间是7-something-AM) date('H:i:s ')
- >07:22:13 date('G:i:s')
- > 7:22:13
Examples (if current time was seven-something-AM)date('H:i:s')
-> "07:22:13"date('G:i:s')
-> "7:22:13"
对于您的具体情况:
$timestamp = date("d/m/Y H:i:s", time());