need to offset a date by intervals of 1 year

View: New views
1 Messages — Rating Filter:   Alert me  

need to offset a date by intervals of 1 year

by mperrone2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am trying to design a report with multiple run dates (i.e. a series of subreports that use date parameters that offset from the prompted date parameters by an integer value of 1 - 4 years).  I first tried to use the DATEADD function in my SQL statement but iReport tells me the function doesn't exist.  So when that didn't work I tried to set up each offset date as a variable.  I figured out that using groovy I could simply create a variable with the expression:

$P{rundate} - 365

but that won't work thanks to leap years.  Any idea how I can offset a date using x number of years?