Skip to content

Latest commit

 

History

History
35 lines (25 loc) · 793 Bytes

File metadata and controls

35 lines (25 loc) · 793 Bytes

dayofweek

description

Syntax

INT dayofweek(DATETIME date)

DAYOFWEEK函数返回日期的工作日索引值,即星期日为1,星期一为2,星期六为7

参数为Date或者Datetime类型或者可以cast为Date或者Datetime类型的数字

example

MySQL > select dayofweek('2019-06-25');
+----------------------------------+
| dayofweek('2019-06-25 00:00:00') |
+----------------------------------+
|                                3 |
+----------------------------------+

MySQL > select dayofweek(cast(20190625 as date));
+-----------------------------------+
| dayofweek(CAST(20190625 AS DATE)) |
+-----------------------------------+
|                                 3 |
+-----------------------------------+

keyword

DAYOFWEEK