MONTH()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Returns the month number of a date.
USAGE
MONTH(date)
Argument Name | Description |
---|---|
| The |
DETAILS
MONTH()
is a date-time function that returns the month number derived from a date or datetime expression.
The return value is a number in the range 1
to 12
for valid dates.
A NULL
is returned for the date 0000-00-00
(not a 0
).
A NULL
is returned if the argument is NULL
or otherwise an invalid date.
EXAMPLES
SELECT MONTH('2020-02-29'),
MONTH('0000-00-00'),
MONTH(NULL);
+---------------------+---------------------+-------------+
| MONTH('2020-02-29') | MONTH('0000-00-00') | MONTH(NULL) |
+---------------------+---------------------+-------------+
| 2 | NULL | NULL |
+---------------------+---------------------+-------------+