[英]Why I can't change date format in PHP
I'm facing problem with date format in PHP because I can't change time format I want to get this format 2015-12-07 13:46:58 am 我在PHP中遇到日期格式问题,因为我无法更改时间格式,我想获取此格式2015-12-07 13:46:58 am
This is timezone 这是时区
date_default_timezone_set("Asia/Phnom_Penh");
date_default_timezone_get();
To echo times out 回声超时
echo date("Y-m-d H:i:s a");
echo date("Y-m-d G:i:s a");
Result 结果
2015-12-07 1:46:58 am 2015-12-07 1:46:58上午
2015-12-07 1:46:58 am 2015-12-07 1:46:58上午
They are the same and 他们是相同的
The Format letter H
or G
is conflicting with a
. 在格式信
H
或G
与冲突的a
。
H
is for a 24 hours clock, which isn't applicable to am/pm suffix H
是24小时制,不适用于am / pm后缀
G
is for a 12 hours clock, but it's 13:46
which is actually 1:46 am
G
是12个小时的时钟,但它是13:46
,实际上1:46 am
Bottom line: the a
rules. 底线:
a
规则。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.