MariaDB MONTH() Function

In MariaDB, MONTH() is a built-in function that extracts the month part from a given date expression and returns it as a number.

MariaDB MONTH() Syntax

This is the syntax of the MariaDB MONTH() function:

MONTH(date)

Parameters

date

Required. A date or datetime expression.

Return value

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

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

MariaDB MONTH() Examples

This statement shows the basic usage of the MariaDB MINUTE() function:

SELECT
    MONTH('10:11:12'),
    MONTH('2023-02-28 10:11:12'),
    MONTH(NOW());

Output:

+-------------------+------------------------------+--------------+
| MONTH('10:11:12') | MONTH('2023-02-28 10:11:12') | MONTH(NOW()) |
+-------------------+------------------------------+--------------+
|                11 |                            2 |            1 |
+-------------------+------------------------------+--------------+

Conclusion

In MariaDB, MONTH() is a built-in function that extracts the month part from a given date expression and returns it as a number.