24 hour format for the actual time?

心已入冬 提交于 2020-03-24 01:30:11

问题


I would like to get the actual date + time, and convert it (the time) to a 24 hour format (e.g: 15/04/2017 13:32:02)

My current code is :

date_default_timezone_set("Asia/Magadan");
$date = date("d/m/Y h:i:s");
echo $date;

That display :

15/04/2017 01:32:02

Thanks.


回答1:


Put the h capital for 24 hour format date("d/m/Y H:i:s");




回答2:


Finally, to change to a 24 hour format we only have to change the H of the hour to a MAJ/CAPS.

$date = date("d/m/Y H:i:s");

http://php.net/manual/en/function.date.php




回答3:


convert (h:i:s) to (H:i:s) . that's worked for me



来源:https://stackoverflow.com/questions/43421586/24-hour-format-for-the-actual-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!