Re: Translate week number to date of the week.

From: <jmmnazario_at_gmail.com>
Date: Wed, 26 Dec 2012 09:47:24 -0800 (PST)
Message-ID: <819ed98e-14a2-46aa-947a-c89bb99402de_at_googlegroups.com>



When I use wk_of_yr = 1;

with date_wk
as (

     select to_date('01/01/'||to_char(sysdate, 'RRRR'), 'MM/DD/RRRR') + rownum - 4 dt
            from dual
            connect by level <= 366

),

    wk_dt as (
            select dt, 
                   to_number(to_char(dt, 'iw')) wk_of_yr
            from date_wk

)

   select min(dt)
   from wk_dt
   where wk_of_yr = 1; -- the first ISO week of year 2012

The value return is : 2012-01-02 00:00:00 (Wrong) The correct value should be : 2012-01-03 00:00:00 (Right)

What I doing Wrong? Received on Wed Dec 26 2012 - 18:47:24 CET

Original text of this message