Curriculum
Course: MYSQL
Login

Curriculum

MYSQL

MySQL References

0/140
Text lesson

WEEKDAY

Example

Retrieve the weekday index for a specified date.

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

Definition and Usage

The WEEKDAY() function returns the weekday index for a provided date.

Note: 0 = Monday, 1 = Tuesday, 2 = Wednesday, 3 = Thursday, 4 = Friday, 5 = Saturday, 6 = Sunday.

Syntax

WEEKDAY(date)

Parameter Values

Parameter

Description

date

Required: The date or datetime from which to extract the weekday index.

Technical Details

Works in:

 From MySQL version 4.0

More Examples

Example

Retrieve the numerical representation of the weekday for a given date.

SELECT WEEKDAY(“2017-01-01”);

Example

Retrieve the numerical representation of the weekday for the current system date.

SELECT WEEKDAY(CURDATE());