使用 PHP date() 函数时,无法从 MySQL fetch_array 转换 AM 时间值。不知道为什么下面的停止时间被打印为晚上 7:00,而应该是上午 11:00。有任何想法吗?任何帮助深表感谢!
<?php
$mysql_output = array('start' => '19:00:00','stop' => '11:00:00');
$start_time = date('g:iA',$mysql_output['start']);
$stop_time = date('g:iA',$mysql_output['stop']);
echo "<p>start_time: $start_time</p>";
echo "<p>stop_time: $stop_time</p>";
?>
结果无法正确转换 AM 时间;stop_time应为上午11:00:
start_time: 7:00PM
stop_time: 7:00PM