Leap Year and Interval Function

Database
Enthusiast

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 advise

Thanks,
Sam
2 REPLIES
Teradata Employee

Re: Leap Year and Interval Function

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

Re: Leap Year and Interval Function

Thank You so much!