UtilitiesTime

How ISO Week Numbers Work (ISO 8601 Explained)

The complete reference for ISO 8601 week numbering — the three rules, year boundary edge cases, 53-week years, and how to calculate week numbers in code.

5 min read

TL;DR — Key Points

ISO 8601The international standard for date and time representation. Defines week numbering rules used across Europe, manufacturing, and business reporting.
Week 1 ruleWeek 1 is the week containing the first Thursday of the year — equivalently, the week containing January 4th.
Week starts MondayEvery ISO week runs Monday through Sunday. This differs from US convention where weeks start on Sunday.
52 or 53 weeksMost years have 52 ISO weeks. A year has 53 weeks if January 1st is Thursday, or if it is a leap year starting on Wednesday or Thursday.
ISO year vs calendar yearThe ISO year can differ from the Gregorian year. December 31 can be in Week 1 of the next ISO year. January 1 can be in Week 52 of the previous ISO year.
Week rangeEach ISO week spans exactly 7 days from Monday to Sunday. Week 1 always contains January 4th of the ISO year.

What Is an ISO Week Number?

An ISO week number is a standardised way of labelling weeks within a year, defined by the international standard ISO 8601. Instead of referencing dates by day and month alone, ISO week numbers allow you to refer to any 7-day period unambiguously — for example, 2026-W21 means the 21st week of ISO year 2026, running from Monday May 18 to Sunday May 24.

Week numbers are widely used in European business and government, manufacturing and supply chain scheduling, software development sprint planning, academic timetables, payroll cycles, and financial reporting. The ISO standard provides a universal reference point so that a German supplier, a Dutch client, and a Swedish logistics firm can all agree on what "Week 21" means without ambiguity.

The standard was first published as ISO 8601 in 1988, building on earlier national standards like DIN 1355 (Germany, 1943). It has been adopted as the default week numbering convention across most of Europe and is the standard used by ERP systems (SAP, Oracle), project management tools (Jira, Linear, Asana), and most modern programming languages including Python and Java.

The confusion around ISO week numbers almost always comes from two sources: the fact that weeks start on Monday (not Sunday as in US convention), and the fact that the ISO year can differ from the calendar year for a few days in early January and late December. Once you understand the three core rules, the system is completely logical and predictable.

The Three Rules of ISO 8601 Week Numbering

Everything about ISO week numbers follows from three simple rules. Understanding these rules fully eliminates all confusion about edge cases.

Rule 1 — Weeks start on Monday and end on Sunday. This is the most important rule and the one most frequently forgotten by developers and analysts coming from US conventions. Monday is day 1 of the ISO week (ISO weekday 1), and Sunday is day 7 (ISO weekday 7). A week that starts on any other day is not an ISO week.

Rule 2 — Week 1 is the week containing the first Thursday of the year. This is equivalent to saying Week 1 is the week containing January 4th (because January 4th is always in the first week that has a majority of its days in the new year). If January 1st is a Monday, Tuesday, Wednesday, or Thursday, it falls in Week 1. If it is a Friday, Saturday, or Sunday, it falls in the last week of the previous ISO year.

Rule 3 — A year has either 52 or 53 ISO weeks. Most years have 52 weeks. A year has 53 weeks when January 1st falls on Thursday, or when it is a leap year and January 1st falls on Wednesday or Thursday. The extra Week 53 is not a quirk — it is a mathematically necessary consequence of mapping 365 (or 366) days to complete Monday-to-Sunday weeks.

The Thursday rule exists because Thursday is the middle day of the ISO week (Mon=1, Tue=2, Wed=3, Thu=4, Fri=5, Sat=6, Sun=7). A week "belongs" to the year that contains its Thursday — ensuring that every ISO week has a majority (at least 4) of its days in the year it is assigned to.

Week Numbering Systems Compared

ISO week numbering is not the only system in use. Here is how it compares to other conventions:

FeatureISO 8601US ConventionOther Regional
Week starts onMondaySundaySaturday (some Middle Eastern)
Week 1 definitionContains first ThursdayContains January 1Varies by region
Weeks per year52 or 5352 or 5352 or 53
Year boundaryCan differ from calendarMatches calendar yearVaries
StandardISO 8601 (international)No formal standardRegional custom
Primary useEurope, manufacturing, B2BUS media, retail, sportsRegional reporting

When the ISO Year Differs from the Calendar Year

The most confusing aspect of ISO week numbers is that the ISO year — the year a week is assigned to — can differ from the Gregorian calendar year for a handful of days in early January and late December. This is not a bug or an inconsistency; it is a direct consequence of Rule 2.

Consider December 31, 2018. That was a Monday. The week containing that Monday ran from December 31, 2018 to January 6, 2019. The Thursday of that week was January 3, 2019 — which falls in 2019. Therefore, that entire week is assigned to ISO year 2019 as Week 1. So December 31, 2018 (calendar year 2018) is in ISO week 2019-W01.

The reverse also happens. January 1, 2021 was a Friday. The week containing that Friday ran from December 28, 2020 to January 3, 2021. The Thursday of that week was December 31, 2020 — which falls in 2020. So that entire week belongs to ISO year 2020 as Week 53. January 1, 2021 (calendar year 2021) is in ISO week 2020-W53.

Here are concrete examples of year boundary dates and their ISO week assignments:

DateCalendar YearISO WeekISO YearNote
December 31, 20182018Week 12019This Monday is in ISO 2019 Week 1
January 1, 20192019Week 12019Tuesday — still in ISO 2019 Week 1
January 1, 20212021Week 532020Friday — ISO 2020 had 53 weeks
January 2, 20212021Week 532020Saturday — still ISO 2020 Week 53
January 3, 20212021Week 532020Sunday — last day of ISO 2020 Week 53
January 4, 20212021Week 12021Monday — ISO 2021 Week 1 begins

The practical implication for developers: when displaying or storing ISO week numbers, always use the ISO year alongside the week number — never the calendar year. A week label of "W01" without its year is ambiguous. "2019-W01" is unambiguous.

Years with 53 ISO Weeks

A year has 53 ISO weeks when it starts on Thursday (common years) or when it is a leap year starting on Wednesday or Thursday. This occurs approximately 71 times per 400-year Gregorian cycle — about 17.75% of all years. Here are recent and upcoming 53-week years:

YearJanuary 1st DayReason
2004ThursdayJan 1 is Thursday → 53 weeks
2009ThursdayJan 1 is Thursday → 53 weeks
2015ThursdayJan 1 is Thursday → 53 weeks
2020Wednesday (leap)Leap year, Jan 1 is Wednesday → 53 weeks
2026ThursdayJan 1 is Thursday → 53 weeks
2032ThursdayJan 1 is Thursday → 53 weeks

For systems that handle fiscal years by week number, 53-week years require special handling. A retail fiscal year that maps to ISO weeks may have 13 four-week periods in most years but 13 weeks plus one extra week in a 53-week year. ERP systems like SAP have specific configuration for 53-week fiscal year handling.

Calculating ISO Week Numbers in Code

Different languages approach ISO week number calculation differently. Some have it built in; others require manual calculation. Here are the canonical approaches.

Python (built-in support): Python's datetime module has native ISO week support via isocalendar(): from datetime import date; d = date(2026, 5, 21); iso_year, iso_week, iso_weekday = d.isocalendar(). This returns a named tuple with year, week (1–53), and weekday (1=Monday, 7=Sunday). In Python 3.9+: d.isocalendar().week gives just the week number.

JavaScript (manual calculation required): JavaScript has no built-in ISO week function, but the algorithm is straightforward. The key steps are: (1) find the Thursday of the input week (adjust date to the Thursday of the same ISO week), (2) find January 1st of that Thursday's year, (3) calculate how many weeks have elapsed. The critical mistake to avoid is using local dates — always use UTC Date methods to prevent timezone-related off-by-one errors at midnight.

Excel (ISOWEEKNUM function): Use =ISOWEEKNUM(A1) where A1 contains a date. This function was added in Excel 2013 and LibreOffice Calc. The older =WEEKNUM(A1) function is not ISO compliant — it starts weeks on Sunday by default and numbers weeks differently near year boundaries. Always use ISOWEEKNUM for European or international reporting.

SQL (PostgreSQL and MySQL): PostgreSQL: SELECT EXTRACT(WEEK FROM date '2026-05-21') — note that PostgreSQL's EXTRACT(WEEK) follows ISO 8601. MySQL: SELECT WEEK('2026-05-21', 3) — mode 3 gives ISO week numbers (Monday start, Week 1 contains first Thursday). MySQL's default WEEK() without the mode argument uses Sunday start and is not ISO compliant.

How to Decide Which Week System You Need

Apply the following logic based on your use case:

1

You need to number weeks consistently across years for business reporting

Use ISO week numbers. They ensure consistent 7-day periods that never straddle month boundaries unpredictably.

2

You are building a sprint calendar or project Gantt chart

Use ISO week numbers. Most project management tools (Jira, Linear, Asana) use ISO weeks for their week numbering.

3

You see a date in late December that appears in Week 1

This is correct ISO behaviour. The date is in the first ISO week of the following year. Use the ISO year, not the calendar year, for reporting.

4

You see January 1 or 2 in Week 52 or 53

Also correct. These days belong to the last ISO week of the previous year. Do not treat this as a bug.

5

You need week numbers in Excel

Use ISOWEEKNUM(date) for ISO-compliant week numbers. The older WEEKNUM() function uses different rules and is not ISO compliant.

6

You are working with US-centric data (NFL, retail, media)

These industries typically use Sunday-start week numbering, not ISO. Verify the convention before assuming ISO.

When Should You Use ISO Week Numbers?

Common scenarios and the correct approach for each:

ScenarioCorrect Approach
European payroll system needing weekly pay periodsISO week numbers — standard across EU labour law
US retail weekly sales reportsSunday-start weeks — not ISO, verify the system's convention
Manufacturing production schedule (Jira/SAP)ISO week numbers — industrial and ERP standard
Academic timetable at a European universityISO week numbers — teaching week 1 maps to ISO Week 1
NFL American football game schedulingSunday-start weeks — not ISO
GitHub issue sprint planningISO week numbers — developer tools default to ISO

Frequently Asked Questions

Why does January 1 sometimes fall in Week 52 or 53?

Because ISO Week 1 is defined as the week containing the first Thursday of the year — not the week containing January 1. If January 1 is a Friday, Saturday, or Sunday, it falls in the last week of the previous ISO year, because the majority of that week belongs to the previous year. This is mathematically consistent and intentional — it ensures that ISO weeks always start on Monday and are always 7 days long.

How do I calculate the ISO week number in JavaScript?

JavaScript does not have a built-in ISO week number function, but you can calculate it: function getISOWeek(date) { const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())); const day = d.getUTCDay() || 7; d.setUTCDate(d.getUTCDate() + 4 - day); const yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1)); return Math.ceil(((d - yearStart) / 86400000 + 1) / 7); }. This correctly handles year boundary edge cases.

How do I get the ISO week number in Python?

Python's datetime module supports ISO week numbers natively via the isocalendar() method: from datetime import date; d = date(2026, 1, 1); year, week, weekday = d.isocalendar(). This returns a tuple of (ISO year, ISO week number, ISO weekday) where Monday = 1 and Sunday = 7.

How do I get the ISO week number in Excel?

Use the ISOWEEKNUM function: =ISOWEEKNUM(A1) where A1 contains a date. This was introduced in Excel 2013. Do not use WEEKNUM() for ISO-compliant week numbers — it uses different rules and starts weeks on Sunday by default, giving different results for dates near year boundaries.

What years have 53 ISO weeks?

A year has 53 ISO weeks if January 1st falls on Thursday, or if it is a leap year where January 1st falls on Wednesday or Thursday. Recent 53-week years include 2004, 2009, 2015, 2020, 2026, and 2032. These occur approximately 71 times per 400-year cycle — roughly 17.75% of all years.

What is the difference between ISO week year and calendar year?

The ISO week year is the year that an ISO week belongs to. It can differ from the Gregorian calendar year for dates in early January or late December. For example, January 1, 2021 (Gregorian year 2021) belongs to ISO week 53 of ISO year 2020. Always use the ISO year when displaying week numbers to avoid reporting weeks like '2020-W53' as '2021-W53'.

Why do European countries use ISO week numbers?

ISO 8601 is the dominant time standard in Europe and is mandated or preferred in many EU member states for official documents, contracts, and business reporting. Germany, Scandinavia, the Netherlands, and most other EU countries number weeks using the ISO standard. The convention pre-dates ISO 8601 — DIN 1355 (Germany, 1943) and similar national standards were harmonised into ISO 8601 in 1988.

How do week numbers work in project management tools?

Most modern project management tools — Jira, Linear, Asana, Notion, GitLab — use ISO 8601 week numbering. When Jira shows 'Week 1' it means ISO Week 1, starting Monday. Some tools allow configuring the week start day, which affects displayed week numbers. Always check the tool's settings if week numbers do not match your expectation.

Related Concepts

Related Tools

Week Number Calculator

Find the ISO week number for any date. Shows week range, year progress, and key milestones.

Open Tool →

Day of Week Calculator

Find what day of the week any date in history or the future falls on.

Open Tool →

Business Days Calculator

Count working days between two dates, excluding weekends and holidays.

Open Tool →

Days Between Dates

Calculate the exact number of days between any two dates.

Open Tool →