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 since 1988 and, before that, it was defined in ISO 2015 since 1971. It is used 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. In every cycle there are 71 years with an additional 53rd week. An average year is exactly 52.1775 weeks long; months average at exactly weeks.
An ISO week-numbering year 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 Monday 23 December 2019 corresponds to Monday in the 52nd week of 2019, and is written 2019-W52-1 or 2019W521. The ISO year is slightly offset to the Gregorian year; for example, Monday 30 December 2019 in the Gregorian calendar is the first day of week 1 of 2020 in the ISO calendar, and is written as 2020-W01-1 or 2020W011.
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 and a Monday through Wednesday, or a Monday and Tuesday, or just a Monday, at the end of the Gregorian 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.First week
The ISO 8601 definition for week 01 is the week with the first Thursday of the Gregorian year 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 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 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 it is on a Friday, it is part of W53 of the previous year.
If it is on a Saturday, it is part of the last week of the previous year which is numbered W52 in a common year and W53 in a leap year.
If it is on a Sunday, it is part of W52 of the previous year.
Last week
The last week of the ISO week-numbering year, i.e. W52 or W53, is the week before W01 of the next year.This week’s properties are:
- It has the year's last Thursday in it.
- It is the last week with a majority 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.
If 31 December is on a Monday or Tuesday it is in W01 of the next year.
If it is on a Wednesday, it is in W01 of the next year in common years and W53 in leap years.
If it is on a Thursday, it is in W53 of the year just ending.
If on a Friday or Saturday it is in W52 of the year just ending.
If on a Sunday, it is in W52 of the year just ending in common years and W01 of the next year in leap years.
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 and any leap year starting on Wednesday
- any year ending on Thursday and any leap year ending on Friday
- years in which 1 January or 31 December are Thursdays
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 following year.
Using only the ordinal year number y, the number of weeks in that year can be determined:
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 = 5.6338… years, and these long years are 43 × 6 years apart, 27 × 5 years apart, and once 7 years apart.
The Gregorian years corresponding to these 71 long years can be subdivided as follows:
- 27 Gregorian leap years, emphasized in the list above:
- * 14 starting on Thursday, hence ending on Friday, and
- * 13 starting on Wednesday, hence ending on Thursday;
- 44 Gregorian common years starting, hence also ending on Thursday.
- 70 are Gregorian leap years.
- 259 are Gregorian common years.
- 27 week years are 5 days longer than the month years.
- 44 week years are 6 days longer than the month years.
- 70 week years are 2 days shorter than the month years.
- 259 week years are 1 day shorter than the month years.
Weeks per month
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 explicitly. The resulting pattern would be irregular. The only 4 months 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 in January and February. With the exception of leap years starting on Thursday, dates with fixed week numbers occur in all months of the year.During leap years starting on Thursday, 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, which calculates the weekday that the last day of February falls on.
The dates listed in the table are all one day after the Doomsday, 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
Some pairs and triplets of ISO weeks have the same days of the month:- W02 and W41 in common years
- W03 with W42 in common years and with W15 and W28 in leap years
- W04 and W43 in common years and with W16 and W29 in leap years
- W05 and W44 in common years
- W06 with W10 and W45 in common years and with W32 in leap years
- W07 with W11 and W46 in common years and with W33 in leap years
- W08 with W12 and W47 in common years and with W34 in leap years
- W10 and W45
- W11 and W46
- W12 and W47
- W15 and W28
- W16 and W29
- W37 and W50
- W38 and W51
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.
Differences to other calendars
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.
The ISO week calendar relies on the Gregorian calendar, which it augments, to define the new year day. 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 designs strive to simplify and harmonize this pattern, some by choosing 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 much of the Americas, although the work week is usually defined to start on Monday, the calendar week is often considered to start on Sunday.
Algorithms
Calculating the week number from a month and day of the month or ordinal date
The week number of any date can be calculated, given its ordinal date and its day of the week. If the ordinal date is not known, it can be computed from the month and day of the month by any of several methods; e.g. using a table such as the following.Month | Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec |
Common year | 000 | 031 | 059 | 090 | 120 | 151 | 181 | 212 | 243 | 273 | 304 | 334 |
Leap year | 000 | 031 | 060 | 091 | 121 | 152 | 182 | 213 | 244 | 274 | 305 | 335 |
Algorithm:
- Subtract the weekday dow from the ordinal date doy.
- Then add 10.
- Divide the result by 7.
- Ignore the remainder.
- The quotient equals the preliminary week number.
- * If the week number thus obtained equals 0, it means that the given date belongs to the preceding 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.
Calculating an ordinal or month date from a week date
- Multiply the week number woy by 7.
- Then add the weekday number dow.
- From this sum subtract the correction for the year:
- * Get the weekday of 4 January.
- * Add 3.
- The result is the ordinal date, which can be converted into a calendar date.
- * If the ordinal date thus obtained is zero or negative, the date belongs to the previous calendar year;
- * if it is greater than the number of days in the year, it belongs to the following year.
Other week numbering systems
The US broadcast calendar designates the week containing 1 January as the first of the year, but otherwise works like ISO week numbering without partial weeks. Up to six days of the previous December may be part of the first week of the year.
A mix of those, wherein weeks start Sunday and all 1 January is part of the first one, is used in US accounting, resulting in a system with years having also 52 or 53 weeks.