Skip to content

DAYOFWEEK

功能描述

返回参数日期为一周中的第几天(值从1到7,周日的值为1)。

语法格式

DAYOFWEEK(expr)

参数说明

expr: DATETIME 类型的字段或变量或表达式

函数返回类型

INTEGER类型字符串

示例

sql
SQL> SELECT DAYOFWEEK('2022-01-01') FROM dual;

EXPR1 | 
------------------------------------------------------------------------------
7 |
    
SQL> SELECT DAYOFWEEK('2022-01-01 12:34:56 BC') FROM dual;

EXPR1 | 
------------------------------------------------------------------------------
2 |
     
SQL> SELECT DAYOFWEEK('2022-01-01'::DATE + 10) FROM dual;

EXPR1 | 
------------------------------------------------------------------------------
3 |

SELECT DAYOFWEEK('') FROM dual;

EXPR1 | 
------------------------------------------------------------------------------
<NULL>|