MySQL Tutorial/Date Time Functions/DAYOFWEEK — различия между версиями

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

Текущая версия на 09:50, 26 мая 2010

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>