totn MariaDB Functions

MariaDB: MONTH Function

This MariaDB tutorial explains how to use the MariaDB MONTH function with syntax and examples.

Description

The MariaDB MONTH function returns the month portion of a date value.

Syntax

The syntax for the MONTH function in MariaDB is:

MONTH( date_value )

Parameters or Arguments

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

Note

Applies To

The MONTH function can be used in the following versions of MariaDB:

  • MariaDB 10

Example

Let's look at some MariaDB MONTH function examples and explore how to use the MONTH function in MariaDB.

For example:

SELECT MONTH('2014-05-19');
Result: 5

SELECT MONTH('2014-05-19 09:04:05');
Result: 5

SELECT MONTH('2013-11-23');
Result: 11

This last MONTH example would display the month portion of the current system date (current system date is returned by the CURDATE function).

SELECT MONTH(CURDATE());