ODFF1.2 interpretation of function WEEKNUM

Eike Rathke erack at redhat.com
Mon Sep 25 14:05:29 UTC 2017


Hi Winfried,

On Monday, 2017-09-25 09:15:46 +0200, Winfried Donkers wrote:

> > This reads to me exactly like the ODF spec, so it seems that Excel is not
> > abiding by the Excel spec if it returns 29-dec as week 53 ...
> > 
> > To quote the Excel spec, "System 1    The week containing January 1 is
> > the first week of the year, and is numbered week 1." That says to me - as
> > a native English speaker, that it is a complete week INCLUDING ANY DAYS
> > BEFORE JAN 1.

Until now I also read it that way..

> > So yes. It looks like Excel does not do what it says it does. Quelle
> > Surprise.

> I have studied quite some sources now and have come to the conclusion that there are 2 views:
> -a generally shared view that is the same as ODFF1.2. This includes MariaDB SQL.
> -a Microsoft view that partial weeks are used. This conflicts a.o. with the Islamitic week numbering system.

It gets even funnier.. citing from
https://www.mrexcel.com/forum/excel-questions/367162-weeknum-returns-53-weeks-post1819547.html#post1819547

| The way WEEKNUM function works week 1 can be as short as 1 day (when 1st
| Jan is a Saturday) and when that co-incides with a leap year (averaging
| about once every 28 years) you also get a week 54, for one day only, on
| 31st December, e.g.
| 
| =WEEKNUM("2028-12-31")=54

That's f*d up ...


This one (as of Office 2007) sheds some light:
https://msdn.microsoft.com/en-us/library/bb277364.aspx#Excel2007Implementingweeknumber_IntroductiontotheWeekNumberingSystems

| Excel WEEKNUM function with an optional second argument of 1 (default).
| Week one begins on January 1st; week two begins on the following Sunday.
| 
| Excel WEEKNUM function with an optional second argument of 2. Week one
| begins on January 1st; week two begins on the following Monday.

"Week one begins on" is the key.

Note that it doesn't mention modes 11..17 (Office 2007 didn't have
them), as those fall as well under the "System 1" of
https://support.office.com/en-gb/article/WEEKNUM-function-e5c43a03-b4ab-426c-b411-b18c13c75340
I assume that assuming those would not fall under the same odd
definition could not be assumed ;-P

> I have closed the bug report as NOTOURBUG.

Which bug# btw?

I'll bring this to the attention of the ODF-TC and, depending on the
outcome, we may have to change implementation, or introduce some
WEEKNUM_EXCEL function.

  Eike

-- 
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A
Care about Free Software, support the FSFE https://fsfe.org/support/?erack
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20170925/c3283f21/attachment.sig>


More information about the LibreOffice mailing list