bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

MySQL WEEKDAY() Function

Concept visual

MySQL WEEKDAY() Function

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

Example

Return the weekday number for a date:

SELECT WEEKDAY("2017-06-15");

Definition and Usage

The WEEKDAY() function returns the weekday number for a given date.

Note:

Formula

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 to extract the weekday number from

Technical Details

Works in:

From MySQL 4.0

More Examples

Example

Return the weekday number for a date:

SELECT WEEKDAY("2017-01-01");

Example

Return the weekday number for the current system date:

SELECT WEEKDAY(CURDATE());

Previous

❮ MySQL Functions

Next

Previous

MySQL WEEK() Function

Next

MySQL WEEKOFYEAR() Function