Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
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());