According to the International Organization for Standardization (ISO), the first calendar week of a year is the one that includes the first Thursday of that year, and the last calendar week of a year is the week immediately preceding the first calendar week of the next year. It follows from this definition that some years have 52 calendar weeks, while others have 53. The calendar weeks are numbered in succession from 1 to 52 or 53, as the case may be. Each week begins on a Monday and ends on a Sunday. Observe that a week may spill over from one year into another. For example, if January 1 of some year is a Wednesday, then ISO week 1 of that year includes the last Monday and Tuesday of the previous year. Similarly, if December 31 of some year is a Saturday, then the last ISO week of that year includes the first Sunday of the following year.
The months of April, June, September, and November are 30 days long. The others have 31 days, with the exception of February, which has 29 days in leap years and 28 days otherwise. A leap year is one that is divisible by 4, except if it is divisible by 100 and not divisible by 400. For example, 1996 and 2000 are leap years, but 2099 and 2100 are not. These rules were introduced by Pope Gregory XIII (hence the name "Gregorian calendar") on October 15, 1582, and are part of the calendar standard promulgated today by the ISO.
Mathematicians and programmers have been familiar with this standard for some time, and have developed efficient methods to calculate ISO week numbers. It is rumored, however, that all the library routines are about to become obsolete. Your newspaper's gossip column states that the ISO council, at its next annual congress in Geneva, will announce a three-day shift in the mapping of dates to weekdays, effective retroactively and into the future. Under this ruling, September 8, 2003 ceases to be a Monday and will henceforth be a Thursday, with all other dates remapped to agree with the order of the weekdays. The ISO standard will remain unchanged in every other respect.
Given three int values specifying the year, month, and day of a date between the introduction of the Gregorian calendar and the last day of the year 9999, inclusive, calculate the ISO number of the week within which it falls under the new mapping.