Thursday, October 27, 2011

informix 找 年 的函數

SELECT  date_created,  date_updated
FROM tableName
WHERE YEAR(date_created) = '2011'
回傳 日期 等於 2011年 的資料

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.
參考來源:
http://stackoverflow.com/questions/6707026/informix-isql-date-function-help