> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# dayofweek

> 返回指定日期的工作日索引值，星期日为 1，星期一为 2，星期六为 7。

返回指定日期的工作日索引值，即星期日为 1，星期一为 2，星期六为 7。

参数为 DATE 或 DATETIME 类型，或者为可以 CAST 成 DATE 或 DATETIME 类型的数字。

## 语法

```Haskell theme={null}
INT dayofweek(DATETIME date)
```

## 示例

```Plain Text theme={null}
select dayofweek('2019-06-25');
+----------------------------------+
| dayofweek('2019-06-25 00:00:00') |
+----------------------------------+
|                                3 |
+----------------------------------+

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


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.