I am trying to replace my requests with a PDO request and I am having problems with date formats. I need to print the dates in the format d / m / YH: i: s, but after running the PDO script, it prints the date in this format Ymd H: i: s
while($row = $sql -> fetch(PDO::FETCH_ASSOC)) { ... echo "<td>" . date_format( $row['date'], 'd/m/YH: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>"; echo "<td>" . $row['date']. "";"</td>"; , then it will return to Ymd H:i:s How can I get the previous format d/m/YH:i:s ?
source share