add year to a date [message #11837] |
Mon, 19 April 2004 00:19  |
kim
Messages: 116 Registered: December 2001
|
Senior Member |
|
|
hi,
I want a function, like add_months, so that I can increment a date by a certain number of years.
eg. add_years(to_date('19.04.2004'),5) will return '19.05.2009'.
thanks for any help
|
|
|
Re: add year to a date [message #11838 is a reply to message #11837] |
Mon, 19 April 2004 00:52   |
roblvl
Messages: 27 Registered: June 2003
|
Junior Member |
|
|
TO ADD ONE YEAR
1* select SYSDATE + NUMTOYMINTERVAL(1,'YEAR') FROM DUAL
SQL> /
SYSDATE+N
---------
19-APR-05
TO ADD ONE YEAR AND 3 MONTHS
SQL> select sysdate+to_yminterval('01-03') from dual;
SYSDATE+T
---------
19-JUL-05
|
|
|
Re: add year to a date [message #11858 is a reply to message #11837] |
Tue, 20 April 2004 05:38   |
jan
Messages: 71 Registered: August 2002
|
Member |
|
|
try this
use add_months(date, 12* no. of years to add).
SELECT sysdate, add_months(sysdate,12*3) "3 Years"
FROM dual
hope this helps
JS
|
|
|
|
|