Name

MONTHNAME( )

Synopsis

MONTHNAME(date)

This function returns the name of the month for the date provided.

SELECT MONTHNAME(appointment)
       AS 'Appointment'
   FROM appointments
   WHERE client_id = '8302'
      AND appointment > NOW( );
+-------------+
| Appointment |
+-------------+
| June        |
+-------------+

In this example, the client has only one appointment after the current date, and it’s in June. As you can with any date and time function, you can use this one in conjunction with other formatting functions like CONCAT( ) for human formatting of data.

Get MySQL in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.