THE WORLD'S LARGEST WEB DEVELOPER SITE

MySQL WEEKDAY() Function

❮ MySQL Functions

Example

Return the weekday index for a date:

SELECT WEEKDAY("2017-06-15");
Try it Yourself »

Definition and Usage

The WEEKDAY() function returns the weekday index for a date value (a number from 0 to ).

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 value from which to extract the weekday index

Technical Details

Works in: MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23

More Examples

Example

Return the weekday index for a date:

SELECT WEEKDAY("2017-01-01");
Try it Yourself »

Example

Return the weekday index for the current system date:

SELECT WEEKDAY(CURDATE());
Try it Yourself »

❮ MySQL Functions