Curriculum
Course: MYSQL
Login

Curriculum

MYSQL

MySQL References

0/140
Text lesson

MONTH

Example

Retrieve the month component from a given date.

SELECT MONTH(“2017-06-15”);

Definition and Usage

The MONTH() function retrieves the month component from a given date, represented as a number from 1 to 12.

Syntax

MONTH(date)

Parameter Values

Parameter

Description

date

Mandatory: The date or datetime value from which to extract the month.

Technical Details

Works in:

 From MySQL version 4.0

More Examples

Example

Retrieve the month component from a specified date.

SELECT MONTH(“2017-06-15 09:34:21”);

Example

Retrieve the month component from the current system date.

SELECT MONTH(CURDATE());