Home »
MySQL »
MySQL date/time Functions
MySQL DAYOFWEEK() Function
MySQL | DAYOFWEEK() Function: Learn about the DAYOFWEEK() function, how it works, its usages, syntax, and examples.
Submitted by Apurva Mathur, on October 05, 2022
DAYOFWEEK() Function
The DAYOFWEEK() function gives you the day of a week in the numerical form of any particular date.
DAYOFWEEK() Syntax
SELECT DAYOFWEEK('date');
DAYOFWEEK() Parameter(s)
- date: It accepts a date for which you have to get the weekday index.
DAYOFWEEK() Return Value
As a result, it will return you the day of the week in the numerical form of the date you have provided.
MySQL DAYOFWEEK() Function Example 1
SELECT DAYOFWEEK('2011-01-17');
MySQL DAYOFWEEK() Function Example 2
SELECT DAYOFWEEK('2022-10-20');
MySQL DAYOFWEEK() Function Example 3
SELECT DAYOFWEEK('2022-19-31');
If the date is not valid then in such case it will return you the NULL.