我使用这个代码来显示现在的时间在我的网站:
<?php date_default_timezone_set('Asia/Tehran'); echo date('h:i:s'); ?>
但是用这个代码显示06:00而不是18:00
从手册:
h 12-hour format of an hour with leading zeros
H 24-hour format of an hour with leading zeros
使用H
而不是h
你可以这样使用-
echo date('H:i:s');