Re: converting a specified year and week into a date - Mailing list pgsql-general

From Ron Johnson
Subject Re: converting a specified year and week into a date
Date
Msg-id 45D2C1C5.1050101@cox.net
Whole thread Raw
In response to Re: converting a specified year and week into a date  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Responses Re: converting a specified year and week into a date  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
List pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02/14/07 01:36, A. Kretschmer wrote:
> am  Tue, dem 13.02.2007, um 13:56:15 -0800 mailte vanessa folgendes:
>> 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
>
> You can extract the week from a given date with this:
>
> SELECT EXTRACT(WEEK FROM '2006-01-01'::date);
>
> Be careful, the 1.1. can be in the 52. week in the last year. If you
> know the first day in the year in week 1, then you can add 7* the given
> week-1 days to this date.

I think she wants to do the opposite: cast 2004w1 to YYYY-MM-DD format.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFF0sHFS9HxQb37XmcRAqClAJ4zkTJU7hT4vSbNM/8HyRqJwbSc1wCfeGJk
Tqr6q1YDe+TajGEY50Bl26Y=
=8i3I
-----END PGP SIGNATURE-----

pgsql-general by date:

Previous
From: "Peter Eisentraut"
Date:
Subject: [ANNOUNCE] Advisory on possibly insecure security definer functions
Next
From: Sujay Bhattacharya
Date:
Subject: Thank you for your email