Curriculum
Course: MYSQL
Login

Curriculum

MYSQL

MySQL References

0/140
Text lesson

DAYOFMONTH

Example

Retrieve the day of the month from a given date.

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

Definition and Usage

The DAYOFMONTH() function retrieves the day of the month from a specified date, represented as a number ranging from 1 to 31.

Note: This function is equivalent to the DAY() function.

Syntax

DAYOFMONTH(date)

Parameter Values

Parameter

Description

date

Necessary. Specify the date from which to extract the day.

Technical Details

Works in:

 From MySQL version 4.0

More Examples

Example

Retrieve the day of the month for a given date.

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

Example

Retrieve the day of the month for the current system date.

SELECT DAYOFMONTH(CURDATE());