Search Postgresql Archives

Re: converting a specified year and week into a date

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxx

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 //


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux