I am trying to format a datetime field in php, but i get this error code:
You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax
to use near 'DATE_FORMAT(date, '%b %d
This is my whole code:
SELECT * FROM topics, DATE_FORMAT(date, '%b %d %Y, %h:%i %p') AS f_date
I’ve checked everything, this is usually how I do my formatting, compared the code to other formattings ive done.
Any help with what’s wrong?
Try
SELECT *, DATE_FORMAT(date, '%b %d %Y, %h:%i %p') AS f_date FROM topics