MySQL Tutorial/Date Time Functions/DAYOFWEEK

Материал из SQL эксперт
Перейти к: навигация, поиск

DAYOFWEEK(date) returns the day of the week for a given date, starting with 1=Sunday, 2=Monday, 3=Tuesday, and so on.

mysql>
mysql> SELECT DAYOFWEEK("0-2-1");
+--------------------+
| DAYOFWEEK("0-2-1") |
+--------------------+
|                  3 |
+--------------------+
1 row in set (0.00 sec)
mysql>


DAYOFWEEK(date) returns the weekday index for date (1 = Sunday, 2 = Monday, ..., 7 = Saturday).

mysql>
mysql> SELECT DAYOFWEEK("1998-02-03");
+-------------------------+
| DAYOFWEEK("1998-02-03") |
+-------------------------+
|                       3 |
+-------------------------+
1 row in set (0.00 sec)
mysql>