SQL - Scalar functions - WEEKS_BETWEEN
The WEEKS_BETWEEN function returns the number of full weeks between the specified arguments.
The schema is SYSIBM.
If there is less than a full week between expression1 and expression2, the result is zero. If expression1 is later than expression2, the result is positive. If expression1 is earlier than expression2, the result is negative. If expression1 or expression2 contains time information, this information is also used to determine the number of full weeks. If expression1 or expression2 does not contain time information, a time of midnight (00.00.00) is used for the argument that is missing time information.
The result of the function is an INTEGER. If either argument can be null, the result can be null. If either argument is null, the result is the null value.
SET :NUM_WEEKS = WEEKS_BETWEEN(DATE '2012-03-06', DATE '2012-02-28')
SET :NUM_WEEKS = WEEKS_BETWEEN(DATE '2012-03-05', DATE '2012-02-28')
SET :NUM_WEEKS = WEEKS_BETWEEN(TIMESTAMP '2013-09-21-23.59.59', TIMESTAMP '2013-09-01-00.00.00')
SET :NUM_WEEKS = WEEKS_BETWEEN(TIMESTAMP '2013-09-01-00.00.00', TIMESTAMP '2013-09-21-23.59.59')