Returns the year of ADATE, unless the ISO week of ADATE exists in the prior year in which case that year is returned.
YEAR_ISO(ADATE DATE)
YEAR_ISO(ADATE TIMESTAMP)
YEAR_ISO(ADATE VARCHAR(26))
RETURNS SMALLINT
Returns the year of ADATE, unless the ISO week number (see the built-in function WEEK_ISO) of ADATE belongs to the prior year, in which case the prior year is returned.
- ADATE
- The date to calculate the ISO-week based year number for.
Calculate the ISO-week based year number of the 1st of January, 2010:
VALUES YEAR_ISO(DATE(2010, 1, 1));
1 ------ 2009
Calculate the ISO-week based year number of the 4th of January, 2010 (dates beyond the 4th of January will always be in the year of the date given the definition of ISO weeks):
VALUES YEAR_ISO(DATE(2010, 1, 4)));
1 ------ 2010
- Source code
- YEAR (built-in function)
- WEEK_ISO (built-in function)