Name

DATE_FORMAT()

Synopsis

DATE_FORMAT(date, format)

Returns the date value formatted according to the format string. Table D-2 shows the specifiers that can be used in the format string. Note that the % character is required before each specifier, as shown. This code returns the given date and time as “Wednesday May 4th 2016 03:02 AM”:

SELECT DATE_FORMAT('2016-05-04 03:02:01', '%W %M %D %Y %h:%i %p');