简体   繁体   English

实际时间是24小时制吗?

[英]24 hour format for the actual time?

I would like to get the actual date + time, and convert it (the time) to a 24 hour format (eg: 15/04/2017 13:32:02 )我想获取实际日期 + 时间,并将其(时间)转换为 24 小时格式(例如: 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.谢谢。

将 h 大写为 24 小时格式 date("d/m/YH:i:s");

Finally, to change to a 24 hour format we only have to change the H of the hour to a MAJ/CAPS.最后,要更改为 24 小时格式,我们只需要将小时的 H 更改为 MAJ/CAPS。

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

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

convert (h:i:s) to (H:i:s) .(h:i:s)转换为(H:i:s) that's worked for me这对我有用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM