CheeseConQueso
CheeseConQueso

Reputation: 6041

Informix iSQL date function help

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()?

Upvotes: 2

Views: 1380

Answers (1)

Jonathan Leffler
Jonathan Leffler

Reputation: 753655

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.

Upvotes: 2

Related Questions