Subject Re: Add Year function
Author alanpltse
Hi,

I just not sure what should I do to add 100 year to the some records now.

Can I use something like ExtractYear from the date field, if it is <
1910 then I add 100 to the year part? I am afraid of if I add the
365xx number to it will cause any incorrect output.

And back to my original problem: UDF, any hints what I did wrong ?

Thanks

--- In firebird-support@yahoogroups.com, Aage Johansen <aagjohan@...>
wrote:
>
> Adam wrote:
> >
> >> Btw, which date is 1 month after 29.02.2004 ? And 1 month before
> > 30.03.2006?
> >
> > To me it is a nonsense. It is like comparing sales for two months. I
> > have seen people confused why there is huge sales variations from one
> > month to the next, when some months have more weekends than others.
> > You can't add a year to a number, nor can you add a month to it.
> > Although it is sometimes possible to do, programming is largely
> > mathematics. It requires fixed rules, and any exceptions dealt with.
> > If you are going to define this date next month as
> >
> > if m = 12 then
> > begin
> > m = 1;
> > y = y + 1;
> > end
> > else
> > begin
> > m = m + 1;
> > end
> >
> > Then that will hit an issue as soon as you get to the end of january
> > and hit a day that does not actually exist in february. As a side
> > note, I am aware of at least one popular dbms that happily accepts
> > nonesense dates like 29 Feb 2006.
> >
> > Your specification must explain the result of adding a month to
29 Jan
> > 2006.
> >
>
>
> I don't disagree with you. I just wondered whether there were
> consensus on how this was done (or should be done).
> In my old documentation for SysTools there are 2 routines for adding
> months to a date: one that makes 29.01.2005 + 1 month into
> 01.03.2005, and another that keeps the date within the next month
> (29.01.2005 + 1 month ends up as 28.02.2005).
> Anyhow, one sometimes has to do things like this. And either way,
> someone is likely to be less than totally satisfied...
>
> --
> Aage J.
>