2

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

wattostudios
  • 8,446
  • 13
  • 40
  • 54
CheeseConQueso
  • 5,493
  • 25
  • 84
  • 126

1 Answers1

2

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.

Jonathan Leffler
  • 666,971
  • 126
  • 813
  • 1,185