在我的数据库中,我已将已发布"行设置为时间戳,但在尝试对其进行转换/格式化时收到此通知:
In my database I have set row "posted" as a timestamp but I get this notice when trying to convert/format it:
Notice: A non well formed numeric value encountered
代码:
$posted = date('d/m/Y H:i:s', $row['posted']);
echo $posted;
我做错了什么?
这意味着 date()
的第二个参数是整数,所以转换 $row['posted']
先打时间戳.
This means that the second parameter for date()
is expecting integer, so convert $row['posted']
to timestamp first.
试试
$posted = date('d/m/Y H:i:s', strtotime($row['posted']));
这篇关于mysql时间戳转换/格式化注意:遇到格式不正确的数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!