-2

Im getting time information from a database that is in 24 hour format(00:00:00). When i get it on the php page, i use:

$output .= date("g:i A", $result1['event_start_time']);

But when i check the data on my client/receiver side, all of the times are the same, right now they are all saying 6:00 PM. I event do a call to get the 'event_end_time' and it also returns the same time.

Is there any way to fix this or where this error is happening.

4

3 回答 3

1

尝试strtotime在您的数据库字段上使用 -

$output .= date("g:i A", strtotime($result1['event_start_time']));

http://us2.php.net/manual/en/function.strtotime.php

于 2012-10-23T17:59:07.423 回答
1

您需要使用strtotime,请参阅手册

$output .= date("g:i A", strtotime($result1['event_start_time']));
于 2012-10-23T18:00:19.300 回答
0

如果您的 event_start_time 以 24 小时格式存储时间,为什么要使用日期函数对其进行转换?

于 2012-10-23T18:02:41.713 回答