Re: Query to return every 1st Sat of a month between two dates - Mailing list pgsql-general

From Michael Nolan
Subject Re: Query to return every 1st Sat of a month between two dates
Date
Msg-id BANLkTi=DS462ZB1awq1dMD0tY=jWWZOQig@mail.gmail.com
Whole thread Raw
In response to Query to return every 1st Sat of a month between two dates  (Alex - <aintokyo@hotmail.com>)
List pgsql-general


On Wed, May 11, 2011 at 10:22 AM, Alex - <aintokyo@hotmail.com> wrote:
Hi,
is there an easy way to return the date of every first Saturday of a month in a data range i.e. 2011-2013


This is one way to do it:, there are others:

select '2011-01-01'::date + s.a as dates from generate_series(0,1095)
as s(a)
where to_char('2011-01-01'::date+s.a,'dd') between '01' and '07'
and to_char('2011-01-01'::date+s.a,'dy') = 'sat'
 
--
Mike Nolan

pgsql-general by date:

Previous
From: Bborie Park
Date:
Subject: Returning NULL to a set returning C type function
Next
From: Tom Lane
Date:
Subject: Re: Returning NULL to a set returning C type function