Alex Page writes:
> From: "Allan Engelhardt" <allane@cybaea.com>
> To: "Brian C. Doyle" <bcdoyle@mindspring.com>;
> <pgsql-general@postgresql.org>
> Sent: Wednesday, August 08, 2001 11:18 PM
> Subject: [GENERAL] Re: First Saturday and Last Saturday of a month
>
>
> > You *do* know the algorithm for testing if year yyyy is a leap year, don't
> you?
>
> > ((yyyy%4) && !(yyyy%400))
>
> ITYM ((yyyy%4) && ( !(yyyy%400) || (yyyy%1000) ) - year 2000 was a leap
> year, even though it was a multiple of 400, because it was a millenium.
Actually it's
y % 4 = 0 and (y % 100 <> 0 or y % 400 = 0)
(SQL pedants would use mod(y,4) etc. instead.)
--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter