 |
 |
Archives of the TeradataForum
Message Posted: Sat, 22 May 2004 @ 10:27:21 GMT
Subj: | | Re: How can I advance a date value? |
|
From: | | Dieter Noeth |
Hi Bob,
calculate the number of years between contract_disc_date and asof_date plus one, that's the number of years you'll have to add:
case when CONTRACT_DISC_DATE < ASOF_DATE then
add_months(CONTRACT_DISC_DATE,
(cast (((ASOF_DATE - CONTRACT_DISC_DATE) year) as int) + 1) * 12)
else CONTRACT_DISC_DATE
end
This deals with leap years also, e.g. 2000-02-29 -> 2004-02-29
Dieter
| |