MySQL: MONTHNAME Function

  • Post author:
  • Post category:MySQL
  • Post comments:1 Comment
MySQL MONTHNAME Function

In this guide, we will explain how to use the MySQL MONTHNAME function with syntax and examples.

Description

The MySQL MONTHNAME function returns the full name of the month for a date.

Syntax

The syntax for the MONTHNAME function in MySQL is:

MONTHNAME( date_value )

Parameters or Arguments

date_value

A date or datetime value from which to extract the full month name.

Note

  • The MONTHNAME function returns the full name of the month (January, February, … December) given a date value.

Applies To

The MONTHNAME function can be used in the following versions :

  • MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23

Example

Let’s look at some MONTHNAME function examples and explore how to use the MONTHNAME function.

For example:

mysql> SELECT MONTHNAME('2014-01-27');
Result: 'January'

mysql> SELECT MONTHNAME('2014-05-08');
Result: 'May'

mysql> SELECT MONTHNAME('2014-12-29');
Result: 'December'

This last MONTHNAME example would display the month name for the current system date (current system date is returned by the CURDATE function).

mysql> SELECT MONTHNAME(CURDATE());

Next Topic : Click Here

This Post Has One Comment

Leave a Reply