Name
DAYOFWEEK()
Synopsis
DAYOFWEEK(date
)
This function returns the numerical day of the week for a given date. Sunday returns a value of 1, and Saturday returns a value of 7. Here is an example:
SELECT DAYOFWEEK('2008-11-03') AS 'Day of Week', DAYNAME('2008-11-03') AS 'Name of Day'; +-------------+-------------+ | Day of Week | Name of Day | +-------------+-------------+ | 2 | Monday | +-------------+-------------+
Get MySQL in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.