我是informix的一名大三学生,正在努力进行一些日期计算。我的源代码中有此代码段:
LET dtRefDate = TODAY;
IF extend( CURRENT, hour to hour ) BETWEEN '06' AND '23' THEN LET
dtRefDate = TODAY+1;
END IF;
有人可以解释一下扩展功能做什么吗? CURRENT和TODAY有什么区别?我不理解与IBM官方文档的区别。谢谢
今天返回一个DATE值,当前返回一个DATETIME(年份到分数(3))值。
EXTEND用于提取DATE或DATETIME值的各个部分。
看这个例子:
> select CURRENT from table(set{1});
(expression)
2019-09-29 10:07:12.000
1 row(s) retrieved.
> select TODAY from table(set{1});
(expression)
09/29/2019
1 row(s) retrieved.
> select extend(TODAY,year to year) from table(set{1});
(expression)
2019
1 row(s) retrieved.
> select extend(TODAY,month to day) from table(set{1});
(expression)
09-29
1 row(s) retrieved.
> select extend(CURRENT,hour to minute) from table(set{1});
(expression)
10:08
1 row(s) retrieved.
>