Subject Re: [ib-support] Re: [IBO] Date Question
Author Jason Wharton
No, is all he needs to do is catch the exception on the case where he is on
a leap year day and the next year doesn't have an equivalent month/day
combination. In which case he should just subtract one from the day and then
it will be fine.

See the interbase language about the BEGIN ... WHEN <errcode> DO ... END
block that will allow him to do just this.

Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com


----- Original Message -----
From: "Helen Borrie" <helebor@...>
To: <ib-support@yahoogroups.com>
Sent: Friday, August 10, 2001 1:03 AM
Subject: Re: [ib-support] Re: [IBO] Date Question


At 05:32 PM 09-08-01 -0600, you wrote:
>I found a solution, maybe not the best, but it seems to work :)
>
>PROCEDURE THIS_DAY_NEXT_YEAR (CURDATE DATE)
>RETURNS (NEXTDATE DATE)
>AS
>DECLARE VARIABLE YY INTEGER;
>DECLARE VARIABLE MM INTEGER;
>DECLARE VARIABLE DD INTEGER;
>BEGIN
> YY = Extract(Year from CURDATE);
> MM = Extract(Month from CURDATE);
> DD = Extract(Day from CURDATE);
>
> NEXTDATE = Cast(mm as char(2))
> || '/' || Cast(dd as char(2))
> || '/' || Cast(yy+1 as char(4));
>
> SUSPEND;
>END


Hans,
You can simply add a year (365 or 366). Hmm, you're still going to have to
decode the date to determine whether it's Leap Year, though. Sounds like
something that is crying out for a UDF.

regards,
Helen




All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________

To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.