Subject Re: [firebird-support] adding one year to date
Author Raigo
SOLVED :)
it has to be

CREATE PROCEDURE KPV_AASTA (
A TIMESTAMP
) RETURNS (
L TIMESTAMP
) AS
declare variable ADay varchar(2);
declare variable AMonth varchar(2);
declare variable AYear Integer;
declare variable liigaasta Integer;
BEGIN

ADay = EXTRACT(DAY from A);
AMonth = EXTRACT(MONTH from A);
AYear = EXTRACT(YEAR from A);
AYear=AYear+1;

select LY from is_leapyear('2004') into :liigaasta;

IF ((liigaasta=1) AND (AMonth=2) AND (ADay=29)) THEN ADay=28;

L = CAST(CAST(ADay as VARCHAR(2))||'.'||
CAST(AMonth as VARCHAR(2))||'.'||
CAST(AYear as VARCHAR(4)) as DATE)-1;

suspend;
END