[MySQL] Format a date as a string

Created on November 30, 2026

Use DATE_FORMAT with a date or datetime and a format string. This example formats the current date returned by NOW() with a four-digit year and two-digit month and day, using the Japanese characters for year, month, and day.

select date_format(now(), "%Y年%m月%d日");

Example output

+---------------------------------------+
| date_format(now(), "%Y年%m月%d日")    |
+---------------------------------------+
| 2022年07月21日                        |
+---------------------------------------+
1 row in set (0.00 sec)
MySQL