Syntax\n------\n\nDATE_FORMAT(date, format[, locale])\n\nDescription\n-----------\n\nFormats the date value according to the format string.\n\nThe language used for the names is controlled by the value of the lc_time_names system variable. See server locale for more on the supported locales.\n\nDate Formatting Options\n\nThe options that can be used by DATE_FORMAT(), as well as its inverse STR_TO_DATE() and the FROM_UNIXTIME() function, are:\n\n| Option | Description                                                                                                                                                                                      |\n| ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| %a     | Short weekday name in current locale (Variable lc_time_names).                |\n| %b     | Short form month name in current locale. For locale en_US this is one of: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, or Dec.                                                       |\n| %c     | Month with 1 or 2 digits.                                                                                                                                                                        |\n| %D     | Day with English suffix 'th', 'nd', 'st' or 'rd''. (1st, 2nd, 3rd...).                                                                                                                           |\n| %d     | Day with 2 digits.                                                                                                                                                                               |\n| %e     | Day with 1 or 2 digits.                                                                                                                                                                          |\n| %f     | Microseconds 6 digits.                                                                                                                                             |\n| %H     | Hour with 2 digits between 00-23.                                                                                                                                                                |\n| %h     | Hour with 2 digits between 01-12.                                                                                                                                                                |\n| %I     | Hour with 2 digits between 01-12.                                                                                                                                                                |\n| %i     | Minute with 2 digits.                                                                                                                                                                            |\n| %j     | Day of the year (001-366)                                                                                                                                                                        |\n| %k     | Hour with 1 digits between 0-23.                                                                                                                                                                 |\n| %l     | Hour with 1 digits between 1-12.                                                                                                                                                                 |\n| %M     | Full month name in current locale (Variable lc_time_names).                   |\n| %m     | Month with 2 digits.                                                                                                                                                                             |\n| %p     | AM/PM according to current locale (Variable lc_time_names).                   |\n| %r     | Time in 12 hour format, followed by AM/PM. Short for '%I:%i:%S %p'.                                                                                                                              |\n| %S     | Seconds with 2 digits.                                                                                                                                                                           |\n| %s     | Seconds with 2 digits.                                                                                                                                                                           |\n| %T     | Time in 24 hour format. Short for '%H:%i:%S'.                                                                                                                                                    |\n| %U     | Week number (00-53), when first day of the week is Sunday.                                                                                                                                       |\n| %u     | Week number (00-53), when first day of the week is Monday.                                                                                                                                       |\n| %V     | Week number (01-53), when first day of the week is Sunday. Used with %X.                                                                                                                         |\n| %v     | Week number (01-53), when first day of the week is Monday. Used with %x.                                                                                                                         |\n| %W     | Full weekday name in current locale (Variable lc_time_names).                 |\n| %w     | Day of the week. 0 = Sunday, 6 = Saturday.                                                                                                                                                       |\n| %X     | Year with 4 digits when first day of the week is Sunday. Used with %V.                                                                                                                           |\n| %x     | Year with 4 digits when first day of the week is Monday. Used with %v.                                                                                                                           |\n| %Y     | Year with 4 digits.                                                                                                                                                                              |\n| %y     | Year with 2 digits.                                                                                                                                                                              |\n| %Z     | Timezone abbreviation. From MariaDB 11.3.0.                                                          |\n| %z     | Numeric timezone +hhmm or -hhmm presenting the hour and minute offset from UTC. From MariaDB 11.3.0. |\n| %#     | For str_to_date(), skip all numbers.                                                                                                                                         |\n| %.     | For str_to_date(), skip all punctation characters.                                                                                                                           |\n| %@     | For str_to_date(), skip all alpha characters.                                                                                                                                |\n| %%     | A literal % character.                                                                                                                                                                           |\n\nTo get a date in one of the standard formats, GET_FORMAT() can be used.\n\nExamples\n--------\n\nSELECT DATE_FORMAT('2009-10-04 22:23:00', '%W %M %Y');\n+------------------------------------------------+\n| DATE_FORMAT('2009-10-04 22:23:00', '%W %M %Y') |\n+------------------------------------------------+\n| Sunday October 2009                            |\n+------------------------------------------------+\n\nSELECT DATE_FORMAT('2007-10-04 22:23:00', '%H:%i:%s');\n+------------------------------------------------+\n| DATE_FORMAT('2007-10-04 22:23:00', '%H:%i:%s') |\n+------------------------------------------------+\n| 22:23:00                                       |\n+------------------------------------------------+\n\nSELECT DATE_FORMAT('1900-10-04 22:23:00', '%D %y %a %d %m %b %j');\n+------------------------------------------------------------+\n| DATE_FORMAT('1900-10-04 22:23:00', '%D %y %a %d %m %b %j') |\n+------------------------------------------------------------+\n| 4th 00 Thu 04 10 Oct 277                                   |\n+------------------------------------------------------------+\n\nSELECT DATE_FORMAT('1997-10-04 22:23:00', '%H %k %I %r %T %S %w');\n+------------------------------------------------------------+\n| DATE_FORMAT('1997-10-04 22:23:00', '%H %k %I %r %T %S %w') |\n+------------------------------------------------------------+\n| 22 22 10 10:23:00 PM 22:23:00 00 6                         |\n+------------------------------------------------------------+\n\nSELECT DATE_FORMAT('1999-01-01', '%X %V');\n+------------------------------------+\n| DATE_FORMAT('1999-01-01', '%X %V') |\n+------------------------------------+\n| 1998 52                            |\n+------------------------------------+\n\nSELECT DATE_FORMAT('2006-06-00', '%d');\n+---------------------------------+\n| DATE_FORMAT('2006-06-00', '%d') |\n+---------------------------------+\n| 00                              |\n+---------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/date_format