MySQL MONTH() Function

In MySQL, the MONTH() function extracts the month part of a date and return it as a number.

MONTH() Syntax

Here is the syntax of MySQL MONTH() function:

MONTH(date)

Parameters

date
Required. A date or datetime expression.

Return value

The MySQL MONTH() function extracts and returns a number that is the month part of a date. The return value of the MONTH() function is between 1 and 12.

If the argument is NULL, the MONTH() function will return NULL.

MONTH() Examples

Here are some examples of the MONTH() function.

SELECT
    MONTH('2022-02-28'),
    MONTH('2022-02-28 10:11:12');
+---------------------+------------------------------+
| MONTH('2022-02-28') | MONTH('2022-02-28 10:11:12') |
+---------------------+------------------------------+
|                   2 |                            2 |
+---------------------+------------------------------+