Render a datetime using format specifiers.
Section: date and time functions
Format dates for display
sql
sql
SELECT DATE_FORMAT(created_at, '%Y-%m-%d %H:%i:%s') AS created_at_fmt FROM orders LIMIT 5;Explanation
Formatting is often better done in the app layer, but this is useful in reports and exports.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing date and time functions