这很简单:
<td>Created Date:</td><td><?php echo $row2['CreatedDate']; ?></td>
然而,它在一个页面中用于具有相同字段名称和相同数据类型datetime的mysql表,但在另一个页面中用于在另一个表中具有完全相同的字段和数据时间类型,文本只是消失。 我试试:
$test = date_format($row2['CreatedDate'], 'g:i A');
echo $test; ?></td>
然后我收到了这个错误:
警告:date_format()期望参数1为DateTime,null中给出null 所以不知何故它是空的。
有什么想法吗?
答案 0 :(得分:0)
尝试以下代码:
$date = date_create($row2['CreatedDate']);
echo date_format($date,"g:i A");