我从24小时格式(00:00:00)的数据库中获取时间信息。当我在php页面上获取它时,我使用:
$output .= date("g:i A", $result1['event_start_time']);
但是,当我检查客户端/接收方的数据时,所有时间都相同,现在他们都在说下午6点。我事件调用获取'event_end_time'并且它也返回相同的时间。
有没有办法解决这个错误或发生错误的地方。
答案 0 :(得分:1)
尝试在数据库字段中使用strtotime
-
$output .= date("g:i A", strtotime($result1['event_start_time']));
答案 1 :(得分:1)
您需要使用strtotime
,请参阅manual
$output .= date("g:i A", strtotime($result1['event_start_time']));
答案 2 :(得分:0)
如果您的event_start_time以24小时格式存储时间,为什么要使用日期函数进行转换?