开发者

Informix iSQL date function help

开发者 https://www.devze.com 2023-03-20 18:44 出处:网络
开发者_运维百科I\'m trying to extract just the year out of either of the built-in date functions of Informix
开发者_运维百科

I'm trying to extract just the year out of either of the built-in date functions of Informix TODAY or CURRENT

Is there a way to do this without SUBSTR()?


Yes: use the YEAR function:

SELECT YEAR(TODAY)
  FROM SysMaster::SysDual;

Similarly for MONTH, DAY, WEEKDAY (0..6). You could use CURRENT instead of TODAY, but that generates a DATETIME value which is then converted to DATE and then analyzed.

0

精彩评论

暂无评论...
验证码 换一张
取 消