Limited support BMC provides limited support for this version of the product. As a result, BMC no longer accepts comments in this space. If you encounter problems with the product version or the space, contact BMC Support.BMC recommends upgrading to the latest version of the product. To see documentation for that version, see BMC AMI Command Center for Db2 13.2

YEAR function


The YEAR function returns an integer data type.

YEAR.png

expression must return one of the following built-in data types:

  • DATE
  • DATE DURATIONA date duration occurs as the result of subtracting two dates.
  • TIMESTAMP
  • TIMESTAMP WITH TIMEZONE
  • TIMESTAMP DURATIONA timestamp duration occurs as the result of subtracting two timestamps with precision=6. The result is the year portion of the derived date, or date or timestamp, duration.

Important

A CHAR/VARCHAR argument is not accepted unless converted by a DATE, TIMESTAMP, or TIMESTAMP_TZ function.

If the argument can be null, the result can be null; if the argument value is null, the result is the null value.

Example
YEAR (DATE ('1991-12-31')) 

results in an integer of value = 1991 It is invalid to specify YEAR (‘1991-12-31’) because the argument is of type CHAR.

Example
YEAR (DATE ('1991-12-31')-DATE ('1995-12-31')) 

results in an integer of value = -4




 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*