Home »
MySQL »
MySQL date/time Functions
MySQL WEEKDAY() Function
MySQL | WEEKDAY() Function: Learn about the WEEKDAY() function, how it works, its usages, syntax, and examples.
Submitted by Apurva Mathur, on October 13, 2022
WEEKDAY() Function
Whenever you need to find the weekday in the numeric form you can use this WEEKDAY() function. This function returns the number of the weekday present in the date which you have provided as a parameter. The range of this function is 0-6 where 0 means Monday and 6 means Sunday.
WEEKDAY() Syntax
SELECT WEEKDAY(datetime);
WEEKDAY() Parameter(s)
- In this function, you only have to provide the date as a parameter.
WEEKDAY() Return Value
As a result, this function will return you the weekday according to the date which you have provided.
MySQL WEEKDAY() Function Example 1
SELECT WEEKDAY ('2020-09-12');
MySQL WEEKDAY() Function Example 2
SELECT WEEKDAY('2021-12-09');