Re: Leap Years

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Leap Years
Date: 2010-02-25 17:20:44
Message-ID: 20100225172043.GA1354@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

In response to Atif Jung :
> INFORMIX uses the rleapyear(year) ESQLC function to determine if a year is a
> leap year or not. Does POSTGRES have an equivalent?
>  
> Thanks to all.
>  
> Atif

You can create such a function:

create or replace function rleapyear(in year int) returns bool as
$$begin
if extract( month from ($1::text || '-02-28')::date +
'1day'::interval) = 2
then
return true;
else
return false;
end if;
end;
$$language plpgsql;

(I don't know how exactly this function works in INFORMIX, my function
is just a guess)

Regards, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431 2EB0 389D 1DC2 3172 0C99

In response to

  • Leap Years at 2010-02-25 17:08:03 from Atif Jung

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Rob Richardson 2010-02-25 17:48:22 Re: Leap Years
Previous Message Atif Jung 2010-02-25 17:08:03 Leap Years