Not sure if I completely follow what the aim is, but I love this topic (trying to overlay weeks onto years).
Does 1/1/2000 fail? JHB, when I run your code I get 52-1999. Again, not sure if I follow the aim, so I'm not certain if that's an unexpected result. Just throwing out test cases.
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. An average year is exactly 52.1775 weeks long; months average at 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 referred to here as a leap week, although ISO 8601 does not use this term. Weeks start with Monday. The first week of a year is the week that contains the first Thursday of the year (and, hence, always contains 4 January). ISO week year numbering therefore slightly deviates from the Gregorian for some days close to 1 January.
My week 2 becomes correct but I always seem to miss week 1 and include that data as week 53??? So I have Week 53 & 2 but would like to have Week 1 & 2.
Not sure if I completely follow what the aim is, but I love this topic (trying to overlay weeks onto years).
Does 1/1/2000 fail? JHB, when I run your code I get 52-1999. Again, not sure if I follow the aim, so I'm not certain if that's an unexpected result. Just throwing out test cases.
In my application, I'm tracking breakdowns on manufacturing machines. Each occurrence has many data points (what is broken, when, who fixed, parts used, etc). We use yyyy/ww to show us trends (increasing or decreasing) to know if actions are making the machine performance more reliable. We prefer to review weekly so this measurement works very well for us.