First Saturday and Last Saturday of a month

From: "Brian C(dot) Doyle" <bcdoyle(at)mindspring(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: First Saturday and Last Saturday of a month
Date: 2001-08-08 17:22:44
Message-ID: 5.1.0.14.2.20010808131935.00b2fa40@proxy
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello all,

I have a Function that gives me the fsunday of a week Based on the date you
give it the select looks like
SELECT Date('now') - timespan( text( date_part( 'dow', Date('now') ) ) ||
'days' )
and if you run that today you will get
?column?
------------------------
2001-08-05 00:00:00-04
(1 row)

Which is what I want it to do ...

Now I need to setup a function that will give me the first Saturday of the
month and then one to get the Last Saturday of the month.

I know that sounds odd but it is necessary for pulling information out of a
database.

Thank you all for you help.

Brian

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joe Conway 2001-08-08 18:01:59 Random strings
Previous Message Jim Caley 2001-08-08 16:18:09 Re: Upgrade 7.0.2 -> 7.1.2: Errors during Restore