On 2010-02-25, Atif Jung <atifjung@gmail.com> wrote:
> --0016e6daaff9970fd004806fd4d9
> Content-Type: text/plain; charset=ISO-8859-1
>
> INFORMIX uses the rleapyear(year) ESQLC function to determine if a year is a
> leap year or not. Does POSTGRES have an equivalent?
not yet.
CREATE FUNCTION rleapyear(integer) RETURNS BOOLEAN AS $$
select extract( day from ( $1 || '-02-28' ) :: date + '1 day'::interval) != 1
$$ LANGUAGE SQL;
it does now! years less than 1900 may give non-useful results locale
dependant, years less that 1600 will not work right.
I can't immagine when a function like that would be more useful than
just doing date arithmetic using intervals.