ODFF1.2 interpretation of function WEEKNUM

Wols Lists antlists at youngman.org.uk
Fri Sep 22 20:17:26 UTC 2017


On 18/09/17 16:20, Winfried Donkers wrote:
> Hi Eike,
> 
> 
> I'm working on tdf112320 and I think that ODFF1.2 may be ambiguous with
> respect to WEEKNUM
> (http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part2.html#WEEKNUM)
> 
> 
> My interpretation of the Semantics for Mode 1,2,11-17 was that
> 
> 'every week starts on Sunday..Saturday, depending on the value of Mode.
> The week containing 1 January is week 1'.
> 
> So, WEEKNUM(DATE(2014,12,29),1) returns 1, as it is a Monday, the week
> starts on Sunday 28 December and 1 January is on the Thursday. All weeks
> have 7 days.
> 
> 
> However, both Excel and Gnumeric use
> 
> 'every week starts on Sunday..Saturday, depending on the value of Mode,
> _or_ on 1 January (with the week number 1)'.
> 
> So, WEEKNUM(DATE(2014,12,29),1) returns 53, as it is a Monday, following
> week 52 and WEEKNUM(DATE(2015,1,1),1) returns 1. Week 53 has 4 days and
> week 1 has 3 days.

I really should read your link to the spec before shooting from the
hip... :-(

But I googled for Excel's definition of weeknum, and found

https://support.office.com/en-gb/article/WEEKNUM-function-e5c43a03-b4ab-426c-b411-b18c13c75340

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.

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

Cheers,
Wol


More information about the LibreOffice mailing list