Re: ISO weeknumbers

From: joel garry <joel-garry_at_home.com>
Date: Mon, 5 Jan 2009 13:36:12 -0800 (PST)
Message-ID: <bc195800-6561-44a0-b042-1b6a59317a2e_at_a29g2000pra.googlegroups.com>



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/
Received on Mon Jan 05 2009 - 15:36:12 CST

Original text of this message