mysql timestamp conversion/formatting Notice: A non well formed numeric value encountered

筅森魡賤 提交于 2019-12-19 05:45:16

问题


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

code:

$posted = date('d/m/Y H:i:s', $row['posted']);
    echo $posted;

what am I doing wrong?


回答1:


This means that the second parameter for date() is expecting integer, so convert $row['posted'] to timestamp first.

Try

$posted = date('d/m/Y H:i:s', strtotime($row['posted']));


来源:https://stackoverflow.com/questions/11622755/mysql-timestamp-conversion-formatting-notice-a-non-well-formed-numeric-value-en

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!