Subject Re: [ib-support] date udf
Author Sindu
Hi Markus,

Thanks for the udf... Btw, I just want to share my 2 cents on how to find
the last day of a month.

pDt is input parameter

declare variable vMonth integer;
declare variable vYear integer;
declare variable EndOfMonth timestamp;

/* Find End of Month:
Increment to 1st of next month - 1 day */
vMonth = extract(month from pDt) + 1;
vYear = extract(year from pDt);
if (vMonth > 12) then begin
vMonth = 1;
vYear = vYear + 1;
end
EndOfMonth = cast(
vYear || '/' || vMonth || '/1 23:59:59' as timestamp) - 1;


On Thu, 3 May 2001, Markus Ostenried wrote:

> Hi Sindu,
>
> >At 08:24 01.05.2001 +0700, you wrote:
> >Hi all,
> >
> >Is there a UDF to find out the last day of a month?
> >
> >And also to increment/decrement a certain date by any months (such as
> >IncMonth(date, NoOfMonth) )?
> >
> >TIA,
> >Sindu
>
>
> try the following StoredProcs. Just take the SQL script
> below and execute it.
> You need a IB 6 Dialect 3 database for it.
>
> HTH,
> Markus
>