As mentioned in the ISO 8601 standard, the ISO calendar year consists either of 52 weeks (i.e. 364 days) or 53 weeks (i.e. 371 days). It is of interest to derive the relative frequencies of the 52-week and 53-week ISO calendar years (these will be referred to as short and long ISO calendar years).
It is a well-known fact that the weekdays in the Gregorian calendar are repeated in an exact 400-year cycle containing 20871 weeks, the same cycle that governs the leap day rule of the Gregorian calendar on which the ISO calendar is dependent.
Assume that in every 400-year (20871-week) cycle there are s 52-week ISO calendar years and l 53-week ISO calendar years. Then the following relations between s and l exist:
or 52 (s + l) + l = 20871.
Thus 52 × 400 + l = 20871
which results in:
The ISO 8601 standard gives no simple algorithm for determining which ISO calendar years are ordinary or short (i.e. contain 52 weeks) and which have a leap week (i.e. contain 53 weeks) and are long. Whether this is the result of sloppy design or simple ignorance is unknown.
The standard only states (sect. 2.2.10 on p. 5):
[...] the first calendar week of a year is that one which includes the first Thursday of that year and [...] the last calendar week of a calendar year is the week immediately preceding the first calendar week of the next calendar year.
Note 3 to section 3.2.2 (p. 10) also mentions:
The rule for determining the first calendar week [...] is equivalent with the rule the first calendar week is the calendar week which includes 4 January.
From the latter rule one can infer that the last week of the ISO calendar year always includes 28 December.
One can easily determine (by inputting the date 28 December) that the 71 long ISO calendar years in each 400-year cycle (starting in 0, 400, 800, 1200, 1600, 2000, 2400, etc.) are the following:
4 32 60 88
9 37 65 93 15 43 71 99 20 48 76 26 54 82 |
105 133 161 189
111 139 167 195 116 144 172 122 150 178 128 156 184 |
201 229 257 285
207 235 263 291 212 240 268 296 218 246 274 224 252 280 |
303 331 359 387
308 336 364 392 314 342 370 398 320 348 376 325 353 381 |
The results are grouped in 28-year cycles per century. The leap week character of any other ISO calendar year can be easily determined by adding the appropriate multiples of 400.
Note that the long ISO calendar years usually follow each other in 5- or 6-year intervals that are governed by a 28-year cycle within each century. Once in every 400 years, there will be a 7-year interval (between the years 296 and 303).
For computational purposes the above table is not very practical and with a bit of rearranging one can derive the following concise algorithm for determining the leap week character of an ISO calendar year y:
f(y) modulo 28 < 5
f(y) modulo 28 > 4
with:
f(y) = 5 y + 12 4 [floor(y/100) floor(y/400)] + g(y) + h(y)
and
g(y) = floor((y100)/400) floor((y102)/400)
h(y) = floor((y200)/400) floor((y199)/400)
The functions g(y) and h(y) are fudge factors whose only purpose are to repair numerical glitches in the above equation near the years 100 + 400 k and 200 + 400 k.
Similarly, one can deduct that:
f(y) modulo 28 > 22
4 < f(y) modulo 28 < 10
9 < f(y) modulo 28 < 23
A long ISO calendar year is always preceded and followed by a short ISO calendar year.
The following diagram can also be used for deriving the character of the ISO calendar year from the result obtained from f(y):
0 | 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 |
long year | short year | ||||||||||||||||||||||||||
short year following a long year | short year both preceded and followed by a short year | short year preceding a long year |
An alternative rule (that does not need a fudge factor), was derived in 2001 by Simon Cassidy (United States):
p(y) modulo 7 = 4or if:p(y1) modulo 7 = 3with:p(y) = y + floor(y/4) floor(y/100) + floor(y/400)
When both relations are satisfied (this occurs 44 times in each 400-year period), the ISO calendar year is also long. However, when neither of both equations is satisfied, the ISO calendar year is short.
Some websites mention the following leap week rule for the ISO calendar:
An ISO calendar year is long if and only if the corresponding Gregorian year begins on a Thursday when it is a common year or begins on a Wednesday when it is a leap year.
This rule has worked fine since 1977 but failed in 2004 (a leap year that began on a Thursday) as the following diagram shows.
December 2003 | January 2004 | |||||||||||||||||||
22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
Mo | Tu | We | Th | Fr | Sa | Su | Mo | Tu | We | Th | Fr | Sa | Su | Mo | Tu | We | Th | Fr | Sa | Su |
ISO week 52 (2003) | ISO week 01 (2004) | ISO week 02 (2004) |
December 2004 | January 2005 | |||||||||||||||||||
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
Mo | Tu | We | Th | Fr | Sa | Su | Mo | Tu | We | Th | Fr | Sa | Su | Mo | Tu | We | Th | Fr | Sa | Su |
ISO week 52 (2004) | ISO week 53 (2004) | ISO week 01 (2005) |
The above rule will fail no less than 13 times in each 400-year repetition cycle. More specifically, this rule will fail to predict the long ISO calendar years 4, 32, 60, 88, 128, 156, 184, 224, 252, 280, 320, 348, 376 and all multiples of 400 added to these years. Software based on the above rule (as in Lotus Notes) may give erroneous results in the last week of the years listed above.
A slight modification of the above rule, apparently first suggested by Sven Pran (Norway) and Lars Nordentoft (Denmark), successfully predicts the long ISO calendar years without any error:
An ISO calendar year is long if and only if the corresponding Gregorian year begins on a Thursday when it is a common year or begins either on a Wednesday or a Thursday when it is a leap year.
A variant of the above rule was proposed in 1997 by Amos Shapir (Israel):
An ISO calendar year is long if and only if the corresponding Gregorian year either begins or ends (or both) on a Thursday.
An alternative rule, formulated in the terminology of the medieval ecclesiastical computus was devised in 1997 by Simon Cassidy (United States):
An ISO calendar year is long if the Dominical letter of the corresponding Gregorian year contains a D (which may be either of the Dominical letters that apply to Gregorian leap years). An ISO calendar year is thus long if the Dominical letter is D, DC or ED.
The Dominical letter of a year indicates the first Sunday of January (i.e. on 1 January for A, on 2 January for B, etc.), from which the location of the other Sundays in the year can be deduced. For leap years the Dominical letter has two parts, the first letter applying for the months January and February and the second letter for the remaining months in the year.
Common years with the single Dominical letter D begin and end on a Thursday. Leap years that begin on a Thursday have the Dominical letter DC while leap years ending on a Thursday have Dominical letter ED.