问题
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