Subject Re: Number of months between dates
Author Svein Erling
> it has some minor problems still ... for example
>
> select * from SP_puhkus (
> '2.6.2004', '20.07.2004'
> )
>
> returns 1, but should be 2. if someone has ideas to improve it (of
> finds more bugs) please let me know.

Simple Raigo, simply correct your SP! You could either do:

IF ((AMonth<>LMonth) and (AYear<>LYear)) then
begin
If (ADay>=15) then worked_months=worked_months-1;
If (LDay>=15) then worked_months=worked_months+1;
end

or

months=LMonth-AMonth+1;

Set

***
NOTICE:
Only members of the Firebird Foundation gets to taste Bamsemums at
Fulda, so join today at http://www.firebirdsql.org/ff/foundation
***