位置:首頁 > 數據庫 > MySQL教學 > MySQL dayofweek()函數

MySQL dayofweek()函數

DAYOFWEEK(date)

返回日期星期索引 (1 = Sunday, 2 = Monday, ., 7 = Saturday). 這些索引值對應於ODBC標準。

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