Skip to content

DAYOFYEAR

功能描述

返回参数日期为一年中的第几天。

语法格式

DAYOFYEAR(expr)

参数说明

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

函数返回类型

INTEGER类型字符串

示例

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

EXPR1 | 
------------------------------------------------------------------------------
1 |
 
SQL> SELECT DAYOFYEAR('2022-12-31') FROM dual;

EXPR1 | 
------------------------------------------------------------------------------
365 |

SQL> SELECT DAYOFYEAR('2022-01-01'::DATE + 10) FROM dual;

EXPR1 | 
------------------------------------------------------------------------------
11 |

SQL> SELECT DAYOFYEAR('2022-12-31 12:34:56 BC') FROM dual;

EXPR1 | 
------------------------------------------------------------------------------
365 |

SQL> SELECT DAYOFYEAR('2022-12-31 12:34:56 -03:40 BC') FROM dual;

EXPR1 | 
------------------------------------------------------------------------------
365 |

SQL> SELECT DAYOFYEAR('') FROM dual;

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