date_format() expects parameter 1 to be DateTime, string given
问题 I'm trying to replace my queries to PDO query and I have problems with date formats. I need to print dates in format d/m/Y H:i:s but after PDO script runs it prints the date in this format Y-m-d H:i:s while($row = $sql -> fetch(PDO::FETCH_ASSOC)) { ... echo "<td>" . date_format( $row['date'], 'd/m/Y H:i:s'). "";"</td>"; ... } Warning: date_format() expects parameter 1 to be DateTime, string given in But if I change the code to echo "<td>" . $row['date']. "";"</td>"; then it returns to Y-m-d H