Re: converting a specified year and week into a date

From: Alban Hertroys <alban(at)magproductions(dot)nl>
To: vanessa <vanessaknell(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: converting a specified year and week into a date
Date: 2007-02-14 10:53:09
Message-ID: 45D2EA15.9080303@magproductions.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

vanessa wrote:
> hi guys,
> i was just wondering if it was at all possible to turn a year and a given
> week number into a real date just using postgresql commands?
>
>
> e.g. if i have year = 2004 and week = 1,
> can i turn that into say 2004-01-01 (so that the specified
> date is the one for the beginning of week 1 in the year 2004
>
>
> thanks
> vanessa :)

I think you're looking for this:

select to_date('01 2004', 'WW YYYY');
to_date
------------
2004-01-01
(1 row)

select to_date('02 2004', 'WW YYYY');
to_date
------------
2004-01-08
(1 row)

--
Alban Hertroys
alban(at)magproductions(dot)nl

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
7500 AK Enschede

// Integrate Your World //

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message A. Kretschmer 2007-02-14 11:00:30 Re: converting a specified year and week into a date
Previous Message Alban Hertroys 2007-02-14 10:33:15 Re: Having a problem with my stored procedure