DAYOFWEEK
Descriptionβ
Returns the weekday index of the date, where Sunday is 1, Monday is 2, and Saturday is 7.
Syntaxβ
DAYOFWEEK(<dt>)
Parametersβ
Parameter | Description |
---|---|
<dt> | The date expression to be calculated |
Return Valueβ
Returns the weekday index of the date.
Examplesβ
select dayofweek('2019-06-25');
+----------------------------------+
| dayofweek('2019-06-25 00:00:00') |
+----------------------------------+
| 3 |
+----------------------------------+
```text
```sql
select dayofweek(cast(20190625 as date));
+-----------------------------------+
| dayofweek(CAST(20190625 AS DATE)) |
+-----------------------------------+
| 3 |
+-----------------------------------+