## November 21, 2005

## When exactly is week 1 of 2006?

According to Jeff, I’ve become a smelly Nokia contractor (the reason he stayed with Luis instead of at Mako’s place in Boston, although I’m sure he was referring to Rob Taylor causing the smell). Part of this entails exchanging project schedules with various managers, where time is often talked about in terms of numbered weeks of the year, like: Foo task will be completed by week 42 of 2005. We ran into some problems with varying definitions of these numbers when exchanging schedules with people running on different platforms. Then we realised that even the software we’re using seems to have different ideas about what’s going on too…

**Outlook**and**Evolution**seem to agree, and define the week as starting on Monday, and the first day of the year is always week 1, even if this results in a truncated week. Hence, week 1 of 2006 starts and ends on Sunday 1st January, and then week 2 begins on Monday 2nd, etc. It’s my belief that this is the correct behaviour as defined by some ISO standard somewhere which governs week numbers.**GtkCalendar**gets the week number correct, in that the first day of the year is always in week 1, but varies its definition of the first day of the week depending on your locale. This is presumably so that the display of the weeks is correct, but using it to number the weeks results in bogus week numbers. For me in`LOCALE=en_GB`

it claims that week 1 of 2006 starts on Sunday 1st January, and ends on Saturday 7th January, making my week numbers one lower than the rest of the world.**Planner**uses GtkCalendar for inputting dates, so gets it wrong there as described, but seems to get it wrong in its Gantt chart view in a different way. It has the week starting on Monday, but claims that January 1st 2006 is the last day of week 52 of 2005. This results in week numbers that, match those GtkCalendar give me on weekdays, but differ over weekends, and are still totally bogus when I try and talk about project plans with my managers.

The result is a whole world of pain, and at best causes extreme confusion when we provide documents referring to both dates and week numbers which are inconsistent with each other in their minds, and at worst makes our managers think we’ll have things done a week sooner than we do. I’m not using Evolution at the moment for calendaring stuff, so I can manage if I remember to add one to all my 2006 week numbers when interacting with managers based on GtkCalendar and Planner, but this all seems to be horribly broken. I really don’t want to have to do this for the whole year.

### 10 responses to “When exactly is week 1 of 2006?”

### Leave a Reply

## Calendar

M | T | W | T | F | S | S |
---|---|---|---|---|---|---|

1 | 2 | 3 | 4 | 5 | 6 | |

7 | 8 | 9 | 10 | 11 | 12 | 13 |

14 | 15 | 16 | 17 | 18 | 19 | 20 |

21 | 22 | 23 | 24 | 25 | 26 | 27 |

28 | 29 | 30 |

## Links

## Archives

- June 2021
- January 2021
- August 2019
- October 2018
- July 2017
- May 2010
- October 2009
- August 2009
- July 2009
- March 2009
- January 2009
- July 2008
- June 2008
- April 2008
- May 2007
- January 2007
- December 2006
- June 2006
- April 2006
- March 2006
- November 2005
- October 2005
- September 2005
- August 2005
- July 2005
- May 2005
- April 2005
- March 2005

You’re slightly off in all of those guesses. According to the ISO 8601 standard, the first week of the year is the week in which the first Thursday is. That is, if Jan 1st is Friday or Saturday, that’s week 53 of the previous year.

The standard also defines that weeks begin on Monday, but that is actually independent of the week number calculation, which is tied to Thursdays only. The logic behind is that thursday is the middle point of the week, so it makes sense starting the count from there. This is almost true even if you start your weeks on a Sunday.

Not sure which one of the programs you refer to is correctly calculating the week numbers, but that’s the official method – and given you’re interested in the week numbers because of Nokia, more importantly that’s how Nokia calculates them in their phones.

ISO 8601 defines week 1 as the first week with the majority of its days in the new year.

Weeks start on monday.

When in doubt, turn to Markus Kuhn’s summary of the international standard date and time notation:

The week notation can also be extended by a number indicating the day of the week. For example, the day 1996-12-31, which is the Tuesday (day 2) of the first week of 1997, can also be written as

for applications like industrial planning where many things like shift rotations are organized per week and knowing the week number and the day of the week is more handy than knowing the day of the month.

An abbreviated version of the year and week number like

is sometimes useful as a compact code printed on a product that indicates when it has been manufactured.

Note:The ISO standard avoids explicitly stating the possible range of week numbers, but this can easily be deduced from the definition. Possible ISO week numbers are in the range 01 to 53. A year always has a week 52. (There is one historic exception: the year in which the Gregorian calendar was introduced had less than 365 days and less than 52 weeks.)

Proof:Per definition, the first week of a year is W01 and consequently days before week W01 belong to the previous year and so there is no week with lower numbers. Considering the highest possible week number, the worst case is a leap year like 1976 that starts with a Thursday, because this keeps the highest possible number of days of W01 in the previous year, i.e. 3 days. In this case, the Sunday of W52 of the worst case year is day number 4+51*7=361 and 361-366=5 days of W53 belong still to this year, which guarantees that in the worst case year day 4 (Thursday) of W53 is not yet in the next year, so a week number 53 is possible. For example, the 53 weeks of the worst case year 1976 started with 1975-12-29 = 1976-W01-1 and ended with 1977-01-02 = 1976-W53-7. On the other hand, considering the lowest number of the last week of a year, the worst case is a non-leap year like 1999 that starts with a Friday, which ensures that the first three days of the year belong to the last week of the previous year. In this case, the Sunday of week 52 would be day number 3+52*7=367, i.e. only the last 367-365=2 days of the W52 reach into the next year and consequently, even a worst case year like 1999 has a week W52 including the days 1999-12-27 to 2000-01-02. q.e.d.

There was a calendar of ISO weeks but it doesn’t seem to be updated anymore.

Actually ISO 8601 defines a week to be in the year that its Thursday is in, i.e. week #1 is the week containing the first Thursday in the new year. This ensures that all weeks are full weeks and that every week can be uniquely identified (under some definitions week 53 of one year can be the same as week 1 of the following year). Especially when planning with weeks this makes a lot of sense.

A good overview of the ISO calendar can be found at http://www.phys.uu.nl/~vgent/calendar/isocalendar.htm.

Btw, at least Evolution 2.2 and the gnome clock applet seem to be using this definition of week numbers

(I’m using LANG=en_US with

LC_TIME=de_AT).

ISO 8601 says a “calendar week” is a “time-interval of seven days, starting on a Monday”, and a “calendar week number” is “its ordinal position within the year, applying the rule that the first calendar week of a year is the one that includes the first Thursday of that year”.

Since AFAIK there’s no definition of week numbers other than the European/ISO one, it makes a certain amount of sense to stick with those rules even when displaying a calendar with the week starting on Sunday. But that could also just be confusing. :-/

According to ISO, the first week is the week containing the first Thursday. So Planner’s Gantt chart is correct ISO-wise: the first week of 2006 starts on January 2nd.

Week 1, as defined by ISO 8601, is the week that has the first thursday of that year.

Wikipedia says this about iso-8601 (which is the only *sane* date standard):

“Week 01 is the week with the year’s first Thursday in it. If 1 January is on a Monday, Tuesday, Wednesday or Thursday, it is in week 01. If 1 January is on a Friday, Saturday or Sunday, it is in week 52 or 53 of the previous year. Weeks 01, 52 and 53 can thus include days from more than one year and, in most years, do so.”

My god…I stumbled upon this very interesting blog by chance, and the most shocking thing? Robert, I actually know who you are, as in we have met, or indeed did meet for most days of the year, unavoidably, for several years, well a few years ago anyway. What an entirely random set of circumstances. Anyway, I am very sorry for adding a slightly rambling quality to this very intelligent discussion but I couldn’t really let the occasion go by without saying Hello đź™‚ If you can guess who I am (or indeed even ever read this comment) or even want to guess then get in touch.

Nice blog by the way, very interesting at 1045 on a Monday morning!

Moi

xx

Hi,

I was looking for how to make Outlook (XP) comply with the ISO 8601 standard (as we’re working with a Dutch customer who uses it). If anyone needs to know:

Tools->Options->Calendar Options,

then change the Ă˘â‚¬Ĺ“First week of yearĂ˘â‚¬Âť field to

“First 4-day week”.

Enjoy.

Peter