Re: Leap Years

Поиск
Список
Период
Сортировка
От Jasen Betts
Тема Re: Leap Years
Дата
Msg-id hm81o6$sg7$1@reversiblemaps.ath.cx
обсуждение исходный текст
Ответ на Leap Years  (Atif Jung <atifjung@gmail.com>)
Список pgsql-novice
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.


В списке pgsql-novice по дате отправления:

Предыдущее
От: "A. Kretschmer"
Дата:
Сообщение: Re: Importing lines of variable length from ASCII
Следующее
От: Jasen Betts
Дата:
Сообщение: Re: Leap Years