Week Numbers and Day of Year, Explained
After reading this you will be able to find the ISO 8601 week number for any date, tell it apart from US week numbering, compute the day of the year by hand, and know why January 1 sometimes lands in week 52 or 53 of the previous year.
What a week number is
A week number labels each week of the year with an integer. The most widely used scheme is ISO 8601. It defines weeks that start on Monday and numbers them so that week 1 is the week containing the year's first Thursday. Under that rule most years have 52 weeks and some have 53.
Here is the hook. Take 2021-01-01, a Friday. You might expect it to sit in week 1 of 2021. In the ISO system it belongs to week 53 of 2020. The week that contains that Friday runs Monday 2020-12-28 through Sunday 2021-01-03, and its Thursday is 2020-12-31, still in 2020. So the whole week counts as a 2020 week.
This is not a bug. It is the price of a clean rule: every ISO week has exactly 7 days and belongs entirely to one ISO year, even when that ISO year disagrees with the calendar year for a few days at each boundary.
When to use week numbers, and when not to
Week numbers are useful when you plan or report in whole-week buckets. Payroll runs, manufacturing schedules, retail sales comparisons, and project timelines in much of Europe are all quoted as "week 32" rather than a date range. If two people agree on ISO week 32 of 2025, they mean the same seven days, Monday 2025-08-04 through Sunday 2025-08-10.
Do not use week numbers when you need an exact gap between two dates, an age, or a count of business days. A week number tells you which bucket a date falls in, not how far apart two dates are. For those tasks use a date calculator instead. Two dates in the same week number can still be up to 6 days apart, and two dates one day apart can carry different week numbers if a Sunday sits between them.
US week numbering is a different scheme. Weeks start on Sunday and week 1 is simply the week containing January 1, with no Thursday rule. For the same date the US week number is often one higher than the ISO number early in the year. Always state which system you mean.
The ISO rule stated precisely
Three facts fully define ISO 8601 weeks.
- A week runs Monday to Sunday.
- Week 1 of a year is the week that contains that year's first Thursday.
- Equivalently, week 1 is the week containing January 4, because January 4 is always in the first week no matter which weekday it falls on.
From those, the ISO week number of any date follows. Let the day of the year be n (January 1 is n = 1) and let the ISO weekday be w, where Monday is 1 and Sunday is 7. Then the week number is:
Here n is the ordinal day of the year, w is the ISO weekday from 1 to 7, the brackets are the floor function (round down to the nearest integer), and W is the week number. The constant 10 encodes the Thursday rule: it shifts the current date to the Thursday of its week, then counts full weeks from the start of the ISO year.
Two edge results need handling. If the formula gives W = 0, the date belongs to the last week (52 or 53) of the previous year. If it gives W = 53 but the current year does not actually have 53 weeks, the date belongs to week 1 of the next year.
Which years have 53 weeks
A year has 53 ISO weeks when January 1 is a Thursday, or when it is a Wednesday in a leap year. Every other year has 52. Over a full 400 year cycle, 71 years are long (53 weeks) and 329 are short, so about 17.75% of years have 53 weeks.
You can also state it by the year's last day. A year has 53 weeks exactly when December 31 falls on a Thursday, or when it falls on a Friday in a leap year. For example, 2020 is a leap year and December 31, 2020 is a Thursday, so 2020 has 53 weeks. That is why 2021-01-01 spilled back into week 53.
A worked example
Week number and day of year for July 1, 2024
The demo uses today's date by default. To make the numbers checkable, work through 2024-07-01, a Monday.
- Find the day of the year. January has 31 days, February 2024 has 29 (leap year), March 31, April 30, May 31, June 30. Sum:
31 + 29 + 31 + 30 + 31 + 30 = 182. Adding July 1 gives n = 183. - Find the ISO weekday. July 1, 2024 is a Monday, so w = 1.
- Apply the formula: W = \lfloor (183 - 1 + 10) / 7 \rfloor = \lfloor 192 / 7 \rfloor = \lfloor 27.43 \rfloor = 27.
- Check the range. Week 27 of 2024 starts on Monday
2024-07-01and ends on Sunday2024-07-07. The date sits on the first day of its week, which matches w = 1.
So 2024-07-01 is day 183 of 2024 and falls in ISO week 27. The US week number for the same date is 27 as well here, because by July the two systems have realigned. 2024 has 52 ISO weeks, since January 1, 2024 was a Monday, not a Thursday.
Reading the results
The lookup gives you four numbers plus a range. Read them like this.
- ISO week
- The Monday-to-Sunday week number under ISO 8601, paired with its ISO year. Watch the year: it can differ from the calendar year near January 1 and December 31.
- US week
- The Sunday-to-Saturday week number where week 1 always contains January 1. Use this only if your systems or partners use it.
- Day of year
- The ordinal day from 1 to 365 or 366. December 31 is day 365 in a common year and day 366 in a leap year.
- Week date range
- The Monday and Sunday that bound the ISO week. This is the concrete seven-day span the week number refers to.
- Weeks in year
- 52 or 53 for the ISO year, which tells you whether a week 53 exists at all.
Common mistakes
The errors below account for most wrong week numbers people report.
- Assuming January 1 is always in week 1. True for US numbering, false for ISO. In 2021, January 1 to January 3 are in ISO week 53 of 2020.
- Pairing the ISO week with the wrong year. "Week 1, 2026" and "Week 53, 2025" can name overlapping days. Always carry the ISO year with the week number.
- Counting Sunday as the start. ISO weeks start Monday. If your calendar app shows Sunday-first weeks, its week numbers may follow the US rule.
- Forgetting leap years in the day count. March 1 is day 60 in a common year and day 61 in a leap year. A hardcoded table breaks every four years.
- Expecting exactly 52 weeks. One year in six or so has 53. Reports that assume 52 buckets lose a week's data in those years.
Related tools
Week numbers place a date in a bucket. For measuring spans, these fit better. To count the exact days between two dates or add and subtract time, use the Date Difference Calculator. For an exact age in years, months and days, use the Age Calculator. To count only business days across a range with your own holiday list, use the Working Days Calculator.
Frequently asked questions
Why is January 1 sometimes in week 52 or 53?
Because an ISO week belongs to whichever ISO year contains its Thursday. When the week straddling January 1 has its Thursday in December, the whole week, January 1 included, counts as the last week of the previous year. That is week 52 or 53 depending on the year.
What is the difference between ISO and US week numbers?
ISO weeks start Monday, and week 1 is the week with the year's first Thursday. US weeks start Sunday, and week 1 is simply the week containing January 1. Early in the year the US number is often one higher, and the two typically realign by spring.
How do I know if a year has 53 weeks?
A year has 53 ISO weeks when its January 1 is a Thursday, or a Wednesday in a leap year. Equivalently, when December 31 is a Thursday, or a Friday in a leap year. 2020 and 2026 are examples of 53-week years.
What is the day of the year for December 31?
It is day 365 in a common year and day 366 in a leap year. Leap years are those divisible by 4, except century years, which must be divisible by 400. So 2000 was a leap year and 1900 was not.
Can two dates in the same week have different week numbers?
Not if they are in the same ISO week, since a week is a fixed Monday-to-Sunday block. But a Saturday and the following Monday, only two days apart, sit in different weeks because Sunday ends the week.