gpt4 book ai didi

php - 我的 php echo row ['Date' ] 不知怎的就消失了

转载 作者:行者123 更新时间:2023-11-29 19:25:58 25 4
gpt4 key购买 nike

这只是一个非常简单的:

<td>Created Date:</td><td><?php echo $row2['CreatedDate']; ?></td>

但是,它在一个页面中适用于具有相同字段名称和相同数据类型日期时间的 mysql 表,但在另一页面中,对于另一个表中具有完全相同字段和数据时间类型的 mysql 表,文本就会消失。我尝试:

$test = date_format($row2['CreatedDate'], 'g:i A');
echo $test; ?></td>

然后我收到此错误:

Warning: date_format() expects parameter 1 to be DateTime, null given in So somehow it is null.

有什么想法吗?

最佳答案

尝试下面的代码:

$date = date_create($row2['CreatedDate']);
echo date_format($date,"g:i A");

关于php - 我的 php echo row ['Date' ] 不知怎的就消失了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42156826/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com