DB2 Scalar functions - AGE
The AGE function returns a numeric value that represents the number of full years, full months, and full days between the current timestamp and the argument.
The schema is SYSIBM.
If there is less than a full day between the current timestamp and expression, the result is zero. If expression is earlier than the current timestamp, the result is positive. If expression is later than the current timestamp, the result is negative.
The result of the function is an INTEGER. If the argument can be null, the result can be null. If the argument is null, the result is the null value.
The AGE function is a synonym of the following expression:
INTEGER( ( CURRENT TIMESTAMP(12) - TIMESTAMP( expression, 12 ) ) / 1000000 )
The result is the integer representation of the extraction of the year, month, and day components of a timestamp duration.
SET :AGE1 = AGE(TIMESTAMP '2012-02-28-12.00.00')
SET :AGE1 = AGE(TIMESTAMP '2013-09-23-12.00.00')
SET :AGE1 = AGE(DATE '2020-01-01')