I am staying now in a place on time under gmt+6
I want to see my time in 24 hour time format. 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
.
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 . ie it should show 22:02:00
but it shows 18:02:00
Thanks in advance.
$timezone = +6; //(GMT +6:00)
echo gmdate("H:i:s", time() + 3600*($timezone+date("I")));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.