`WEEKDAY` in MySQL: returns an index from 0 to 6 for Monday to Sunday. `DAYOFWEEK` in MySQL: returns an index from 1 to 7 for Sunday to Saturday. Doris only have `DAYOFWEEK` function, so I add `WEEKDAY` function. Thanks for the following materials: - https://github.com/apache/incubator-doris/pull/6982/files - https://www.bilibili.com/video/BV1V44y1Y7Ro
1.6 KiB
1.6 KiB
title, language
| title | language |
|---|---|
| dayofweek | zh-CN |
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