Re: ISO weeknumbers

From: Shakespeare <whatsin_at_xs4all.nl>
Date: Tue, 06 Jan 2009 20:47:09 +0100
Message-ID: <4963b53d$0$200$e4fe514c_at_news.xs4all.nl>



joel garry schreef:
> On Jan 5, 12:41 pm, "Terry Dykstra" <tddyks..._at_forestoil.ca> wrote:
>> The IW format string returns the ISO week number
>>
>> IW
>>  No
>>      Week of year (1-52 or 1-53) based on the ISO standard.
>>
>> I'm confused by this.  When would you get week 53?  For example, when
>> running this against the last week of 2008 (using 9.2.0.7 SE) , it switches
>> from week 52 to week 1 while still in December.
>>
>> select to_char(to_date('20081228','yyyymmdd') ,'IW') from dual;> 52
>>
>> select to_char(to_date('20081229','yyyymmdd') ,'IW') from dual;
>>
>>> 01
>> --
>> Terry Dykstra

>
> "The first week of a year is the week that contains the first Thursday
> of a year."
> http://en.wikipedia.org/wiki/ISO_week_date
> "If 1 January is on a Friday, Saturday or Sunday, it is in week 52 or
> 53 of the previous year. 28 December is always in the last week of
> its year."
> http://en.wikipedia.org/wiki/ISO_8601
>
> See metalink Notes:179534.1 and 238676.1.
>
> So this year, Thursday was the new years day, and going back to Monday
> is in 2009. Next year, it will be on a Friday, so this year, 2009,
> will have 53 weeks. This is confusing enough I almost thought you had
> a bug!
>
> SYS_at_10.2.0.4 > select to_char(to_date('20081231','yyyymmdd') ,'iyyy/
> IW') from dual;
>
> TO_CHAR
> -------
> 2009/01
>
> SYS_at_10.2.0.4 > select to_char(to_date('20091231','yyyymmdd') ,'iyyy/
> IW') from dual;
>
> TO_CHAR
> -------
> 2009/53
>
> jg
> --
> _at_home.com is bogus.
> Polar Express: http://new.dailyexpress.co.uk/posts/view/77987/

The complex definition of week 1 actually boils down to "the week with 4 january" doesn't it?

Shakespeare Received on Tue Jan 06 2009 - 13:47:09 CST

Original text of this message