7 Replies Latest reply on Jan 1, 2010 10:12 AM by comment_1

# Week of the Year

### Title

Week of the Year

### Post

FM function WeekOfYear return wrong value for year 2010 for example.

1 Jan 2010 is week 53 (year 2009) not week 1 and 8 Jan 2010 is week 1 not 2.Normally the 1st week of the year is the week when 1 Jan is after Wednesday.Or I'm wrong?

• ###### 1. Re: Week of the Year
Week starts on Sunday , Ends on Saturday. Therefore it falls in the rare 53rd week of year.
• ###### 2. Re: Week of the Year

littledog wrote:
Or I'm wrong?

I believe so. I find that =

WeekOfYear ( Date ( 1 ; 1 ; 2010 ) )

returns 1 as expected. And for Jan 8, 2010 the result is 2 - again, as expected.

• ###### 3. Re: Week of the Year

RSchaub wrote:
the rare 53rd week of year.

53rd week isn't rare at all - in fact, every year has one. Dec 31 of any year is always in the 53rd week of that year, and the following Jan 1 is in the same week, except when the year started on a Sunday and wasn't a leap year - so this "rare" thing happens in almost 90% of the cases.

• ###### 4. Re: Week of the Year

No - this isn't what is expected.

That is correct. That is how world look on things.

When I say - let's plan meeting on the second week 2010, the everybody looking on every average day planner see dates 11-17 Jan 2010 NOT 4-10 Jan 2010 - as FM calculate.

So - calculations must be added to this function OR may be easier is write a new one.

• ###### 5. Re: Week of the Year

littledog wrote:

That is how world look on things.

There are very few things on which the world looks in one way, and this isn't one of them - see, for example:

http://www.pjh2.de/datetime/weeknumber/wnd.php?l=en

So being "correct" depends on what one defines as correct. Look at the help on WeekOfYear() function to see which philosophy the function follows. If you want to calculate the week number according to a different standard, you will need to use another calculation: for example, to get the ISO 8601 week number, try =

WeekOfYearFiscal ( date ; 2 )

• ###### 6. Re: Week of the Year

In Help is discovered full useless of this function in any WeekOfYear standard: FM calculate weeks from 1 to 54 for every year and don't care about the day of the 1/1/Year.

This is the first case where I find out useless of FM function.

I write all this just to say - be careful and don' trust to the FM calculation result in this particular case. Only this.

• ###### 7. Re: Week of the Year

I believe the WeekOfYear() function returns the same results as the WEEKNUM function in Excel.

Whether that is useless or not is a matter of opinion.

I certainly agree that one should read very carefully what each function does.