[英]How to get 24 hour time format in gmt+6
I am staying now in a place on time under gmt+6 我现在准时住在格林尼治标准时间+6下
I want to see my time in 24 hour time format. 我想以24小时制查看时间。 I wrote the code :
我写了代码:
date_default_timezone_set('Etc/GMT+6');
echo $date2=date("H:i:s");
But it shows time in 12 hour format like time is: 10:02:00
. 但是它以12小时格式显示时间,例如:10:
10:02:00
: 10:02:00
。
but whet I write only the following line 但是我只写了以下几行
echo $date2=date("H:i:s");
It shows me time in 12 hour format but always take 4 hour less . 它以12小时格式显示我的时间,但总是少用4小时。 ie it should show
22:02:00
but it shows 18:02:00
即它应该显示
22:02:00
但它显示18:02:00
Thanks in advance. 提前致谢。
$timezone = +6; //(GMT +6:00)
echo gmdate("H:i:s", time() + 3600*($timezone+date("I")));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.