D/MySQL
MySQL DAYOFWEEK()
yeon.Biju
2020. 4. 1. 16:31
MySQL 날짜함수, 시간함수
DAYOFWEEK()
- 주의 몇번째(weekday index) 인지를 return.
DAYOFWEEK(date)
Returns the weekday index for date(1=Sunday, 2=Monday.... 7=Saturday). These index value correspond to the ODBC standard.
mysql> SELECT DAYOFWEEK(NOW());
+------------------+
| DAYOFWEEK(NOW()) |
+------------------+
| 4 |
+------------------+
1 row in set (0.00 sec)
mysql> SELECT DAYOFWEEK('2020-04-01');
+-------------------------+
| DAYOFWEEK('2020-04-01') |
+-------------------------+
| 4 |
+-------------------------+
1 row in set (0.00 sec)