3 ms·
A function you sometimes need is to convert date to business week of year (output is year, week number) where "week 1 is the week with the year's first Thursday
by jhallenworld 11y ago
A function you sometimes need is to convert date to business week of year (output is year, week number) where "week 1 is the week with the year's first Thursday in it (the formal ISO definition)".
https://en.wikipedia.org/wiki/ISO_8601#Week_dates https://en.wikipedia.org/wiki/ISO_8601#Week_dates
Week numbers are useful for comparing equal length business quarters. Each quarter has 13 weeks except the last which can have 14 (but not much business last week of year).
- mark-r 11y agoThat's on the site too: https://www.programmingalgorithms.com/algorithm/week-of-year https://www.programmingalgorithms.com/algorithm/week-of-year Seems a bit over complicated though, I wonder if it could be simplified the way the day-of-week calculation is simplified.