Re: How can I get the first and last date of a week, based on the week number and the year

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Adrian Klaver <aklaver(at)comcast(dot)net>
Cc: pgsql-general(at)postgresql(dot)org, Bruno Baguette <bruno(dot)baguette(at)gmail(dot)com>
Subject: Re: How can I get the first and last date of a week, based on the week number and the year
Date: 2008-02-27 04:39:01
Message-ID: 13475.1204087141@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Adrian Klaver <aklaver(at)comcast(dot)net> writes:
> On Tuesday 26 February 2008 5:32 pm, Bruno Baguette wrote:
>> I have a week number (ISO 8601) and a year, based on theses values, I
>> would like to get the first and the last dates of that week.

> This will get you to the Monday of the week .

> select to_date('9 08','IW YY');
> to_date
> ------------
> 2008-02-25
> (1 row)

date_trunc('week', ...) would probably be a more convenient way of doing
that.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Hiroshi Saito 2008-02-27 04:44:38 Re: UUID-OSSP for windows.
Previous Message Tom Lane 2008-02-27 04:34:51 Re: bug in 8.3? foreign key refers to different type