ISO week date
The ISO week date system is effectively a leap week calendar system that is part of the ISO 8601 date and time standard issued by the International Organization for Standardization (ISO) since 1988 (last revised in 2004) and, before that, it was defined in ISO (R) 2015 since 1971. It is used (mainly) in government and business for fiscal years, as well as in timekeeping. This was previously known as "Industrial date coding". The system specifies a week year atop the Gregorian calendar by defining a notation for ordinal weeks of the year.
The Gregorian leap cycle, which has 97 leap days spread across 400 years, contains a whole number of weeks (20871). In every cycle there are 71 years with an additional 53rd week (corresponding to the Gregorian years that contain 53 Thursdays). An average year is exactly 52.1775 weeks long; months (^{1}⁄_{12} year) average at exactly 4.348125 weeks.
An ISO week-numbering year (also called ISO year informally) has 52 or 53 full weeks. That is 364 or 371 days instead of the usual 365 or 366 days. The extra week is sometimes referred to as a leap week, although ISO 8601 does not use this term.
Weeks start with Monday. Each week's year is the Gregorian year in which the Thursday falls. The first week of the year, hence, always contains 4 January. ISO week year numbering therefore slightly deviates from the Gregorian for some days close to 1 January.
A precise date is specified by the ISO week-numbering year in the format YYYY, a week number in the format ww prefixed by the letter 'W', and the weekday number, a digit d from 1 through 7, beginning with Monday and ending with Sunday. For example, the Gregorian date Sunday 31 December 2006 corresponds to the Sunday of the 52nd week of 2006, and is written 2006-W52-7 (in extended form) or 2006W527 (in compact form).
Week | Mon | Tue | Wed | Thu | Fri | Sat | Sun |
---|---|---|---|---|---|---|---|
W35 | 26 | 27 | 28 | 29 | 30 | 31 | 01 |
W36 | 02 | 03 | 04 | 05 | 06 | 07 | 08 |
W37 | 09 | 10 | 11 | 12 | 13 | 14 | 15 |
W38 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
W39 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
W40 | 30 | 01 | 02 | 03 | 04 | 05 | 06 |
Contents
Relation with the Gregorian calendar
The ISO week year number deviates from the Gregorian year number in one of three ways. The days differing are a Friday through Sunday, or a Saturday and Sunday, or just a Sunday, at the start of the Gregorian year (which are at the end of the previous ISO year) and a Monday through Wednesday, or a Monday and Tuesday, or just a Monday, at the end of the Gregorian year (which are in week 01 of the next ISO year). In the period 4 January to 28 December the ISO week year number is always equal to the Gregorian year number. The same is true for every Thursday.
Date | Notes | ||
---|---|---|---|
Gregorian | ISO | ||
Sat 1 Jan 2005 | 2005-01-01 | 2004-W53-6 | |
Sun 2 Jan 2005 | 2005-01-02 | 2004-W53-7 | |
Sat 31 Dec 2005 | 2005-12-31 | 2005-W52-6 | |
Sun 1 Jan 2006 | 2006-01-01 | 2005-W52-7 | |
Mon 2 Jan 2006 | 2006-01-02 | 2006-W01-1 | |
Sun 31 Dec 2006 | 2006-12-31 | 2006-W52-7 | |
Mon 1 Jan 2007 | 2007-01-01 | 2007-W01-1 | Both years 2007 start with the same day. |
Sun 30 Dec 2007 | 2007-12-30 | 2007-W52-7 | |
Mon 31 Dec 2007 | 2007-12-31 | 2008-W01-1 | |
Tue 1 Jan 2008 | 2008-01-01 | 2008-W01-2 | Gregorian year 2008 is a leap year. ISO year 2008 is 2 days shorter: 1 day longer at the start, 3 days shorter at the end. |
Sun 28 Dec 2008 | 2008-12-28 | 2008-W52-7 | |
Mon 29 Dec 2008 | 2008-12-29 | 2009-W01-1 | ISO year 2009 begins three days before the end of Gregorian 2008. |
Tue 30 Dec 2008 | 2008-12-30 | 2009-W01-2 | |
Wed 31 Dec 2008 | 2008-12-31 | 2009-W01-3 | |
Thu 1 Jan 2009 | 2009-01-01 | 2009-W01-4 | |
Thu 31 Dec 2009 | 2009-12-31 | 2009-W53-4 | ISO year 2009 has 53 weeks and ends three days into Gregorian year 2010. |
Fri 1 Jan 2010 | 2010-01-01 | 2009-W53-5 | |
Sat 2 Jan 2010 | 2010-01-02 | 2009-W53-6 | |
Sun 3 Jan 2010 | 2010-01-03 | 2009-W53-7 |
First week
The ISO 8601 definition for week 01 is the week with the Gregorian year's first Thursday in it. The following definitions based on properties of this week are mutually equivalent, since the ISO week starts with Monday:
- It is the first week with a majority (4 or more) of its days in January.
- Its first day is the Monday nearest to 1 January.
- It has 4 January in it. Hence the earliest possible first week extends from Monday 29 December (previous Gregorian year) to Sunday 4 January, the latest possible first week extends from Monday 4 January to Sunday 10 January.
- It has the year's first working day in it, if Saturdays, Sundays and 1 January are not working days.
If 1 January is on a Monday, Tuesday, Wednesday or Thursday, it is in week 01. If 1 January is on a Friday, it is part of week 53 of the previous year. If it is on a Saturday, it is part of the last week of the previous year which is numbered 52 in a common year and 53 in a leap year. If it is on a Sunday, it is part of week 52 of the previous year.
Last week
The last week of the ISO week-numbering year, i.e. the 52nd or 53rd one, is the week before week 01. This week’s properties are:
- It has the year's last Thursday in it.
- It is the last week with a majority (4 or more) of its days in December.
- Its middle day, Thursday, falls in the ending year.
- Its last day is the Sunday nearest to 31 December.
- It has 28 December in it. Hence the earliest possible last week extends from Monday 22 December to Sunday 28 December, the latest possible last week extends from Monday 28 December to Sunday 3 January.
If 31 December is on a Monday, Tuesday or Wednesday, it is in week 01 of the next year. If it is on a Thursday, it is in week 53 of the year just ending; if on a Friday it is in week 52 in common years and week 53 in leap years; if on a Saturday or Sunday, it is in week 52 of the year just ending.
Year start on (G/W) |
Common year 365 − 1 or + 6 |
Leap year 366 − 2 or + 5 |
---|---|---|
Mon/01 Jan | G +0 −1 | GF +0 −2 |
Tue/31 Dec | F +1 −2 | FE +1 −3 |
Wed/30 Dec | E +2 −3 | ED +2 +3 |
Thu/29 Dec | D +3 +3 | DC +3 +2 |
Fri/04 Jan | C −3 +2 | CB −3 +1 |
Sat/03 Jan | B −2 +1 | BA −2 +0 |
Sun/02 Jan | A −1 +0 | AG −1 −1 |
Weeks per year
The long years, with 53 weeks in them, can be described by any of the following equivalent definitions:
- any year starting on Thursday (dominical letter D or DC) and any leap year starting on Wednesday (ED)
- any year ending on Thursday (D, ED) and any leap year ending on Friday (DC)
- years in which 1 January and/or 31 December are Thursdays
All other week-numbering years are short years and have 52 weeks.
The number of weeks in a given year is equal to the corresponding week number of 28 December, because it is the only date that is always in the last week of the year since it is a week before 4 January which is always in the first week of the year. Using only the ordinal year number, the number of weeks in that year can be determined:^{[1]}
The following 71 years in a 400-year cycle have 53 weeks (371 days); years not listed have 52 weeks (364 days); add 2000 for current years:
004 | 009 | 015 | 020 | 026 |
032 | 037 | 043 | 048 | 054 |
060 | 065 | 071 | 076 | 082 |
088 | 093 | 099 | ||
105 | 111 | 116 | 122 | |
128 | 133 | 139 | 144 | 150 |
156 | 161 | 167 | 172 | 178 |
184 | 189 | 195 | ||
201 | 207 | 212 | 218 | |
224 | 229 | 235 | 240 | 246 |
252 | 257 | 263 | 268 | 274 |
280 | 285 | 291 | 296 | |
303 | 308 | 314 | ||
320 | 325 | 331 | 336 | 342 |
348 | 353 | 359 | 364 | 370 |
376 | 381 | 387 | 392 | 398 |
On average, a year has 53 weeks every ^{400}⁄_{71} = 5.6338… years, and these long ISO years are 43 × 6 years apart, 27 × 5 years apart, and once 7 years apart (between years 296 and 303). The Gregorian years corresponding to these 71 long years can be subdivided as follows:
- 27 Gregorian leap years, emphasized in the list above:
- 44 Gregorian common years starting, hence also ending on Thursday.
The Gregorian years corresponding to the other 329 short ISO years (neither starting nor ending with Thursday) can also be subdivided as follows:
- 70 are Gregorian leap years.
- 259 are Gregorian common years.
Thus, within a 400-year cycle:
- 27 week years are 5 days longer than the month years (371 − 366).
- 44 week years are 6 days longer than the month years (371 − 365).
- 70 week years are 2 days shorter than the month years (364 − 366).
- 259 week years are 1 day shorter than the month years (364 − 365).
Weeks per month
The ISO standard does not define any association of weeks to months. A date is either expressed with a month and day-of-the-month, or with a week and day-of-the-week, never a mix.
Weeks are a prominent entity in accounting where annual statistics benefit from regularity throughout the years. Therefore, in practice usually a fixed length of 13 weeks per quarter is chosen which is then subdivided into 5 + 4 + 4 weeks, 4 + 5 + 4 weeks or 4 + 4 + 5 weeks. The final quarter has 14 weeks in it when there are 53 weeks in the year.
When it is necessary to allocate a week to a single month, the rule for first week of the year might be applied, although ISO 8601 does not consider this case. The resulting pattern would be irregular. The only 4 months (or 5 in a long year) of 5 weeks would be those with at least 29 days starting on Thursday, those with at least 30 days starting on Wednesday, and those with 31 days starting on Tuesday.
Dates with fixed week number
For all years, 8 days have a fixed ISO week number (between 01 and 08) in January and February. And with the exception of leap years starting on Thursday, dates with fixed week numbers occur in all months of the year (for 1 day of each ISO week 01 to 52):
Month | Dates | Week numbers | ||||
---|---|---|---|---|---|---|
January | 04 | 11 | 18 | 25 | 01–04 | |
February | 01 | 08 | 15 | 22 | 05–08 | |
March | 01 | 08 | 15 | 22 | 29 | 09–13 |
April | 05 | 12 | 19 | 26 | 14–17 | |
May | 03 | 10 | 17 | 24 | 31 | 18–22 |
June | 07 | 14 | 21 | 28 | 23–26 | |
July | 05 | 12 | 19 | 26 | 27–30 | |
August | 02 | 09 | 16 | 23 | 30 | 31–35 |
September | 06 | 13 | 20 | 27 | 36–39 | |
October | 04 | 11 | 18 | 25 | 40–43 | |
November | 01 | 08 | 15 | 22 | 29 | 44–48 |
December | 06 | 13 | 20 | 27 | 49–52 |
During leap years starting on Thursday (i.e. the 13 years numbered 004, 032, 060, 088, 128, 156, 184, 224, 252, 280, 320, 348, 376 in a 400-year cycle), the ISO week numbers are incremented by 1 from March to the rest of the year. This last occurred in 1976 and 2004 and will not occur again before 2032. These exceptions are happening between years that are most often 28 years apart, or 40 years apart for 3 pairs of successive years: from year 088 to 128, from year 184 to 224, and from year 280 to 320.
The day of the week for these days are related to the “Doomsday” algorithm because for any year, the “Doomsday” that the algorithm calculates is the weekday that the last day of February falls on.
The dates listed in the table are all one day after the Doomsdays, except that in January and February of leap years the dates themselves are Doomsdays. In leap years the week number is the rank number of its Doomsday.
Equal weeks
W06 | 05 | 06 | 07 | 08 | 09 | 10 | 11 |
---|---|---|---|---|---|---|---|
W10 | 05 | 06 | 07 | 08 | 09 | 10 | 11 |
W45 | 05 | 06 | 07 | 08 | 09 | 10 | 11 |
W07 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
W11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
W46 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
W08 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
W12 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
W47 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
The pairs 02/41, 03/42, 04/43, 05/44, 15/28, 16/29, 37/50, 38/51 and triplets 06/10/45, 07/11/46, 08/12/47 have the same days of the month in common years. Of these, the pairs 10/45, 11/46, 12/47, 15/28, 16/29, 37/50 and 38/51 share their days also in leap years. Leap years also have triplets 03/15/28, 04/16/29 and pairs 06/32, 07/33, 08/34.
The weeks 09, 19–26, 31 and 35 never share their days of the month with any other week of the same year.
Week number | Calendar date | 01 08 15 22 29 |
02 09 16 23 30 |
03 10 17 24 31 |
04 11 18 25 -- |
05 12 19 26 -- |
06 13 20 27 -- |
07 14 21 28 -- |
Week table Jan & Feb for leap years | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
01–04 | 40–43 | Jan | Oct | A | B | C | D | E | F | G | 00 | 06 | 12 | 17 | 23 | ||
01–04 | 14–17 | 27–30 | Jan | Apr | Jul | G | A | B | C | D | E | F | 01 | 07 | 12 | 18 | 24 |
36–39 | 49–52 | Sep | Dec | F | G | A | B | C | D | E | 02 | 08 | 13 | 19 | 24 | ||
23–26 | Jun | E | F | G | A | B | C | D | 03 | 08 | 14 | 20 | 25 | ||||
05–08 | 09–13 | 44–48 | Feb | Mar | Nov | D | E | F | G | A | B | C | 04 | 09 | 15 | 20 | 26 |
05–08 | 05–09 | 31–35 | Feb | 29th/Sun | Aug | C | D | E | F | G | A | B | 04 | 10 | 16 | 21 | 27 |
18–22 | May | B | C | D | E | F | G | A | 05 | 11 | 16 | 22 | 00 | ||||
Year's first 2-digit mod 4 | 20 00 16 |
21 01 17 |
22 02 18 |
23 03 19 |
Year's last 2- digit mod 28 |
Months in the same row are corresponding months and the dates with the same day letter fall on the same weekday. All the D days are the dates with fixed week number. When leap years start on Thursday, the ISO week numbers are incremented by 1 from March to the rest of the year. For the current century letters in column A are domimical letters and years in row C are leap week years (long years). This table can be used to look up dominical letters (DL), day letters (dl), weekdays (w), week numbers (n), and the ISO week date (WD). Letters both in a century column (A C E G) and year rows (c, y) are dominical letters for years of the century. Letters both in day columns and a month row (d, m) are day letters for days of the month.
- For 1 October 2032 (CD)
- c = 20, y = 32 mod 28 = 4, d = 1, m = Oct;
- DL = (20, 04/04) = DC, dl = (1, Oct) = A, D = 4 Oct (40 + 1);
- C = Sun, A = Fri, D = Mon (41);
- n = 41 - 1 = 40, w = 5;
- WD = 2032–W40–5.
- For 1980–W40–1
- c = 19, y = 80 mod 28 = 24, n = 40, w = 1 = Mon;
- DL = (19, 24/24) = FE, D = 4 Oct (40);
- E = Sun, D = Sat (40), F = Mon 6 (41) = Mon 29 Sep (40);
- CD = Monday 29 September 1980.
Advantages
- All weeks have exactly 7 days, i.e. there are no fractional weeks.
- Every week belongs to a single year, i.e. there are no ambiguous or double-assigned weeks.
- The date directly tells the weekday.
- All week-numbering years start with a Monday and end with a Sunday.
- When used by itself without using the concept of month, all week-numbering years are the same except that some years have a week 53 at the end.
- The weeks are the same as used with the Gregorian calendar.
Disadvantages
Solar astronomic phenomena, such as equinoxes and solstices, vary in the Gregorian calendar over a range spanning three days, over the course of each 400-year cycle, while the ISO Week Date calendar has a range spanning 9 days. For example, there are March equinoxes on 1920-W12-6 and 2077-W11-5 in UT.
The year number of the ISO week very often differs from the Gregorian year number for dates close to 1 January. For example, 29 December 2014 is ISO 2015-W01-1, i.e., it is in year 2015 instead of 2014. A programming bug confusing these two year numbers is probably the cause of some Android users of Twitter being unable to log in around midnight of 29 December 2014 UTC.^{[2]}
The ISO week calendar relies on the Gregorian calendar, which it augments, to define the new year day (Monday of week 01). As a result, extra weeks are spread across the 400 year cycle in a complex, seemingly random pattern. There is no simple algorithm to determine whether a year has 53 weeks from its ordinal number alone. Most calendar reform proposals using leap week calendars are simpler in this regard, although they may choose a different leap cycle.
Not all parts of the world consider the week to begin with Monday. For example, in some Muslim countries, the normal work week begins on Saturday, while in Israel it begins on Sunday. In the US and in most of Latin America, although the work week is usually defined to start on Monday, the week itself is often considered to start on Sunday.
Calculation
Calculating the week number of a given date
The week number of any date can be calculated, given its ordinal date (i.e. position within the year) and its day of the week. If the ordinal date is not known, it can be computed by any of several methods; perhaps the most direct is a table such as the following.
To the day of | 13 Jan |
14 Feb |
3 Mar |
4 Apr |
5 May |
6 Jun |
7 Jul |
8 Aug |
9 Sep |
10 Oct |
11 Nov |
12 Dec |
i |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Add | 000 | 031 | 059 | 090 | 120 | 151 | 181 | 212 | 243 | 273 | 304 | 334 | 003 |
Leap year | 000 | 031 | 060 | 091 | 121 | 152 | 182 | 213 | 244 | 274 | 305 | 335 | 002 |
Algorithm | od = 30 (m - 1) + floor (0.6 (m + 1)) - i + d | ||||||||||||
Year's last 2–digit mod 28 (y) | 01 | 02 | 03 | 04 | 05 | 06 | |||||||
07 | 08 | 09 | 10 | 11 | 12 | ||||||||
13 | 14 | 15 | 16 | 17 | |||||||||
18 | 19 | 20 | 21 | 22 | 23 | ||||||||
24 | 25 | 26 | 27 | 00 | |||||||||
Correction (c) Year's first 2–digit mod 4 (C) |
00 | 00 | 01 | 02 | 03 | - 3 | - 2 | - 1 | |||||
01 | - 2 | - 1 | 00 | 01 | 02 | 03 | - 3 | ||||||
02 | 03 | - 3 | - 2 | - 1 | 00 | 01 | 02 | ||||||
03 | 01 | 02 | 03 | - 3 | - 2 | - 1 | 00 | ||||||
Algorithm | c = (y + floor ((y - 1)/4) + 5 C - 1) mod 7 - 7 if the result > 3 |
Method: Using ISO weekday numbers (running from 1 for Monday to 7 for Sunday), subtract the weekday from the ordinal date, then add 10. Divide the result by 7. Ignore the remainder; the quotient equals the week number. If the week number thus obtained equals 0, it means that the given date belongs to the preceding (week-based) year. If a week number of 53 is obtained, one must check that the date is not actually in week 1 of the following year.
Friday 26 September 2008
- Ordinal day: 244 + 26 = 270
- Weekday: Friday = 5
- 270 − 5 + 10 = 275
- 275 ÷ 7 = 39.28…
- Result: Week 39
The week date can also be given by
- ceil ((od + c)/7) = week number
- (od + c) mod 7 = weekday number
for od and c look up the table above or use the algorithm to calculate. There are 53 weeks in any year (c = 3) or in leap years (c = 2), otherwise there are 52 weeks in a year.
Ceiling the quotient equals the week number and the remainder is the weekday number (0 = Sunday = 7).
For 26 September 2008
- ceil ((244 + 26 + 01)/7) = 39
- (244 + 26 + 01) mod 7 = 5
- od = 30 (9 - 1) + floor (0.6 (9 + 1)) - 2 + 26 = 244 + 26 = 270
- c = (8 + floor ((8 - 1)/4) + 5 x 00 - 1) mod 7 = 1
- ceil ((270 + 1)/7) = 39
- 271 mod 7 = 5
the week date is 2008W395.
Calculating a date given the year, week number and weekday
This method requires that one know the weekday of 4 January of the year in question.^{[a]} Add 3 to the number of this weekday, giving a correction to be used for dates within this year.
Method: Multiply the week number by 7, then add the weekday. From this sum subtract the correction for the year. The result is the ordinal date, which can be converted into a calendar date using the table in the preceding section. If the ordinal date thus obtained is zero or negative, the date belongs to the previous calendar year; if greater than the number of days in the year, to the following year.
Example: year 2008, week 39, Saturday (day 6)
- Correction for 2008: 5 + 3 = 8
- (39 × 7) + 6 = 279
- 279 − 8 = 271
- Ordinal day 271 of a leap year is day 271 − 244 = 27 September
- Result: 27 September 2008
The ordinal date (od) can also be given by
- 7 (week number - 1) + weekday number - c
which can be converted into a calendar date, the day (d) of the month (m), using the table above or by the algorithm below:
- m = floor (od/30) + 1
- d = od mod 30 - floor (0.6 (m + 1)) + i.
For example, as above: 2008W396
- od = 7 (39 - 1) + 6 - 1 = 271
- d = 271 - 244 = 27 September
- m = floor (271/30) + 1 = 10
- d = 271 mod 30 - floor (0.6 (10 + 1)) + 2 = -3
October -3 = September 27 (30 - 3).
Other week numbering systems
For an overview of week numbering systems see week number.
The US system has weeks from Sunday through Saturday, and partial weeks at the beginning and the end of the year, i.e. 53 or 54 weeks. An advantage is that no separate year numbering like the ISO year is needed. Correspondence of lexicographical order and chronological order is preserved (just like with the ISO year-week-weekday numbering), but partial weeks make some computations of weekly statistics or payments inaccurate at the end of December or the beginning of January.
A variant of this US scheme groups the possible 1 to 6 days of December remaining in the last week of the Gregorian year within week 1 in January of the next Gregorian year, to make it a full week, bringing a system with accounting years having also 52 or 53 weeks and only the last 6 days of December may be counted as part of another year than the Gregorian year.
The US broadcast calendar counts the week containing 1 January as the first of the year, but otherwise works like ISO week numbering without partial weeks.
See also
Notes
- ^ Either see calculating the day of the week, or use this quick-and-dirty method: Subtract 1965 from the year. To this difference add one-quarter of itself, dropping any fractions. Divide this result by 7, discarding the quotient and keeping the remainder. Add 1 to this remainder, giving the weekday number of 4 January. Do not use for years past 2100.
- ^ Gent, Robert H. "The Mathematics of the ISO 8601 Calendar".
- ^ Hern, Alex (29 December 2014). "Twitter kicks Android app users out for five hours due to 2015 date bug". the Guardian. Retrieved 29 May 2019.