OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

# office-formula message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: Re: [office-formula] WEEKNUM reference

• From: Eike Rathke <erack@sun.com>
• To: office-formula@lists.oasis-open.org
• Date: Fri, 23 Feb 2007 16:54:01 +0100

```Hi David,

On Thursday, 2007-02-22 10:56:03 -0500, David A. Wheeler wrote:

> Wheeler:
> > > 1. Simple/absolute weeks
> > > We can cover the "absolute/simple" week number system with a trivial modification to WEEKNUM.  Here's a proposal: if WEEKNUM's second parameter is "0", then the simple week number is returned.  That would mean that WEEKNUM(d;0) == WEEKNUM(x; WEEKDAY(DATE(1;1;YEAR(x))).
>
> Eike:
> > Apart from that it would be DATE(YEAR(x);1;1) instead, I don't see why
> > WEEKNUM(d;0) would be equal to WEEKNUM(x;n) with n!=0.
>
> Ooops, I changed the unbound variable midways through. Bad me!  Let me try again; what I meant was:
> WEEKNUM(x;0) == WEEKNUM(x; WEEKDAY(DATE(1;1;YEAR(x)))

I still don't see how that's meant. Maybe a misunderstanding from mixing
absolute and simple weeks. From my understanding the definitions are:

1. Absolute week, as used by US military:
The first 7 days of a year are the first week, regardless of the
day-of-week the year started with, days 8-14 are the second week, and
so on. This would be covered with a 2nd argument of 0.

2. Simple weeks, as used in many countries not following ISO 8601 and
implemented by Excel:
Week 1 always is the week containing January 1, week number changes
to week 2 as soon as the start-day-of-week is reached. Remaining days
of the first week in the previous year are always in week 53
respectively 54 of that year.

> Eike:
> > Actually quite a few locales not using ISO 8601 week numbering use
> > minimum-number-of-days 1, resulting in the first week of the year being
> > the week where the first start-of-week-day of that year is, which would
> > be covered by your 1..7 proposal above.
> >
> > Some, similar to ISO 8601, use minimum-number-of-days 4, but with Sunday
> > as start-of-week-day. These would need extra handling. Currently the
> > locales are *-CA Canada and *-MT Malta, according to the CLDR
> > supplementalData.xml
>
> Eek.  Okay, I stand corrected.
>
> Okay, I think there's wide agreement that we need to _AT LEAST_ add support for 1..7 as the second parameter.
>
> Should we add the optional 3rd parameter for "minimum number of days in a week??

Yes, we should, so we can support

> "0" for simple years?

No, 1; see definition of simple week #2 and my previous explanation
above. For absolute weeks (argument2 = 0) the parameter is meaningless
and must be ignored.

Eike

--
Automatic string conversions considered dangerous. They are the GOTO statements
of spreadsheets.  --Robert Weir on the OpenDocument formula subcommittee's list.
```

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]