For the complete documentation index, see llms.txt. This page is also available as Markdown.

WEEKDAY

Return the weekday index. This function returns the index of the day of the week (0=Monday, 6=Sunday).

Syntax

WEEKDAY(date)

Description

Returns the weekday index for date (0 = Monday, 1 = Tuesday, ... 6 = Sunday).

This contrasts with DAYOFWEEK() which follows the ODBC standard (1 = Sunday, 2 = Monday, ..., 7 = Saturday).

Examples

SELECT WEEKDAY('2008-02-03 22:23:00');
+--------------------------------+
| WEEKDAY('2008-02-03 22:23:00') |
+--------------------------------+
|                              6 |
+--------------------------------+

SELECT WEEKDAY('2007-11-06');
+-----------------------+
| WEEKDAY('2007-11-06') |
+-----------------------+
|                     1 |
+-----------------------+

This page is licensed: GPLv2, originally from fill_help_tables.sql

spinner

Last updated

Was this helpful?