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

DAY

Example

Retrieve the day of the month from a given date.

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

Definition and Usage

The DAY() 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 DAYOFMONTH() function.

Syntax

DAY(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 DAY(“2017-06-15 09:34:21”);

Example

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

SELECT DAY(CURDATE());