All Forums Database
samit_9999 37 posts Joined 03/06
06 Mar 2008
Leap Year and Interval Function

Hi,I have a query which runs on a monthly basis taking into account the last day of previous month and substracting 65 years from it.This month when the query ran , the last day of the previous month was set to 2008-02-29.Since 2008 is a leap year the query aborted with Invalid Date issue.select (DATE '2008-02-29' - INTERVAL '65' YEAR) What's the work around to this problem?Please adviseThanks,Sam

Fred 1096 posts Joined 08/04
06 Mar 2008

One option:SELECT ADD_MONTHS(date'2008-02-29',-(65*12))

samit_9999 37 posts Joined 03/06
06 Mar 2008

Thank You so much!

You must sign in to leave a comment.