Re: [GENERAL] Need beginning and ending date value for a particular week in the year

2009-05-26 Thread Alvaro Herrera
Alban Hertroys wrote: > I recall using generate_series() and EXTRACT(week FROM ...) to populate > the table in one pass for several years, but I don't have the exact > incantation at hand now. I'd have to experiment a bit to get that back > again, I don't have access to it anymore. There's som

Re: [GENERAL] Need beginning and ending date value for a particular week in the year

2009-05-26 Thread Keaton Adams
This looks great and is a much easier solution to the problem than what I had planned. Thanks! Keaton mydb=# select ( date('2009-01-01') + ('1 day'::interval * (21-1)*7)) - ('1 day'::interval * (select 7 - extract(dow from timestamp '2009-01-01'))); ?column? - 2009-05-18

Re: [GENERAL] Need beginning and ending date value for a particular week in the year

2009-05-26 Thread Alban Hertroys
On May 26, 2009, at 8:03 PM, Keaton Adams wrote: PG 8.1.17 For a given week number (2009w22) I need to calculate the beginning and ending date that makes up that particular week in the year. I want to use the beginning/ending date as part of a CHECK constraint on an inherited table, with

Re: [GENERAL] Need beginning and ending date value for a particular week in the year

2009-05-26 Thread John R Pierce
So for the calculated week value (i.e. 2009w22) I need to be able to calculate the first and last day of the week (05/25/2009 and 05/31/2009). Is there a clean / fairly easy way to do this? I can think of doing some string comparisons and walking through date values to figure it out but was