Week Numbering: ISO 8601 vs US (POSIX) System
Understand the difference between ISO 8601 and US week numbering. Learn when week 1 starts, first-day-of-week conventions, and how to get week numbers in code.
Concepts
Detailed Explanation
Week Numbering Systems
Two primary week numbering systems exist, and they can assign different week numbers to the same date. This difference causes subtle bugs in reporting, scheduling, and financial calculations.
ISO 8601 Week Numbering
Rules:
- Weeks start on Monday
- Week 1 is the week containing the first Thursday of the year
- Equivalently, week 1 contains January 4th
- A year has either 52 or 53 weeks
January 2026:
Mo Tu We Th Fr Sa Su
1 2 3 4 ← Week 1 (contains Jan 1, a Thursday)
5 6 7 8 9 10 11 ← Week 2
US (POSIX) Week Numbering
Rules:
- Weeks start on Sunday
- Week 1 is the week containing January 1st
- Partial weeks at the start count as week 1
January 2026:
Su Mo Tu We Th Fr Sa
1 2 3 ← Week 1
4 5 6 7 8 9 10 ← Week 2
When Do They Differ?
The biggest differences occur at year boundaries:
December 31, 2025 (Wednesday):
ISO week: 1 of 2026 (belongs to next year!)
US week: 53 of 2025
January 1, 2026 (Thursday):
ISO week: 1 of 2026
US week: 1 of 2026
Getting Week Numbers in Code
| Language | ISO Week | US Week |
|---|---|---|
| Python | d.isocalendar()[1] or %V |
%U (Sun) / %W (Mon) |
| JavaScript | Manual calculation | Manual calculation |
| Java | d.get(WeekFields.ISO.weekOfYear()) |
d.get(WeekFields.SUNDAY_START.weekOfYear()) |
| PHP | date("W") (ISO) |
date("W") only supports ISO |
| Go | d.ISOWeek() |
Manual calculation |
| C# | ISOWeek.GetWeekOfYear(d) |
CultureInfo.CurrentCulture.Calendar.GetWeekOfYear() |
Impact on Software
- Financial reporting — fiscal week definitions vary by company and country
- Payroll systems — week start day affects overtime calculations
- Analytics dashboards — weekly aggregations differ based on system
- Scheduling software — "next week" means different things
- Date pickers — should the calendar start on Sunday or Monday?
First Day of Week by Region
| Start Day | Regions |
|---|---|
| Monday | Europe, most of Asia, Australia, Africa (ISO standard) |
| Sunday | United States, Canada, Japan, Israel, Philippines |
| Saturday | Much of the Middle East (Iran, Afghanistan) |
Use Case
Week numbering impacts business intelligence reports with weekly aggregations, payroll processing where pay periods are weekly, project management tools showing week-based timelines, agricultural and academic scheduling that follows week numbers, and ISO 8601-based financial reporting in European markets.