Re: Re: First Saturday and Last Saturday of a month

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Alex Page <alex(dot)page(at)solid-state-logic(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Re: First Saturday and Last Saturday of a month
Date: 2001-08-09 16:23:23
Message-ID: Pine.LNX.4.30.0108091818580.698-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Alex Page writes:

> From: "Allan Engelhardt" <allane(at)cybaea(dot)com>
> To: "Brian C. Doyle" <bcdoyle(at)mindspring(dot)com>;
> <pgsql-general(at)postgresql(dot)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(at)gmx(dot)net http://funkturm.homeip.net/~peter

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joe Conway 2001-08-09 17:13:18 Re: Random strings
Previous Message dado feigenblatt 2001-08-09 16:09:18 webware