The US week number equals ceil((day-of-year + weekday-of-1-January) / 7), where Sunday is 0 and Saturday is 6. This formula matches Microsoft Excel's WEEKNUM(date, 1) and is the rule used by this site's US calculator.
The US anchor: Sunday on or before 1 January
US week 1 starts on the Sunday on or before 1 January. Every following Sunday starts the next numbered week.
The first week can be as short as one day. If 1 January is a Saturday, week 1 contains only that day. If 1 January is a Sunday, week 1 is a full seven-day week.
This anchor is older than ISO 8601 and is the default mode in Excel's WEEKNUM function.
Step-by-step algorithm
The algorithm has three steps. It works for any date in any year.
- Find the day-of-year of the target date, with 1 January equal to 1.
- Find the day-of-week of 1 January, with Sunday equal to 0 and Saturday equal to 6.
- Compute
ceil((day-of-year + day-of-week-of-1-Jan) / 7). The result is the US week number.
The formula relies on integer ceiling division. In code, use Math.ceil or the trick -(-a // b) for integer ceiling.
Worked examples
Four dates show the formula in action. Each result was verified against the live calculator.
1 January 2027 (Friday) is US week 1. Day-of-year is 1. Weekday of 1 January 2027 is 5 (Friday). ceil((1 + 5) / 7) = ceil(6 / 7) = 1.
28 May 2026 (Thursday) is US week 22. Day-of-year is 148. Weekday of 1 January 2026 is 4 (Thursday). ceil((148 + 4) / 7) = ceil(152 / 7) = 22.
31 December 2026 (Thursday) is US week 53. Day-of-year is 365. Weekday of 1 January 2026 is 4. ceil((365 + 4) / 7) = ceil(369 / 7) = 53.
4 January 2026 (Sunday) is US week 2. Day-of-year is 4. Weekday of 1 January 2026 is 4 (Thursday). ceil((4 + 4) / 7) = ceil(8 / 7) = 2. The first Sunday of 2026 starts week 2 because 1 January 2026 already sits inside week 1.
Excel WEEKNUM modes
Microsoft Excel exposes four useful week-numbering modes via two functions. The official reference is the WEEKNUM function documentation.
WEEKNUM(date, 1)returns Sunday-start weeks with week 1 containing 1 January. This is the US default and matches this site's US calculator.WEEKNUM(date, 2)returns Monday-start weeks with week 1 containing 1 January. Useful for US offices that prefer Monday starts but reject ISO 8601.WEEKNUM(date, 21)returns ISO 8601 week numbers. It uses Monday-start weeks and the first-Thursday rule.ISOWEEKNUM(date)returns ISO 8601 week numbers in Excel 2013 and later. It is equivalent toWEEKNUM(date, 21).
Default WEEKNUM(date) with no second argument is identical to WEEKNUM(date, 1).
Code snippets
Two implementations match the formula. Both have been verified to produce the worked-example results.
Python uses ceiling division on integer arithmetic.
from datetime import date
def us_week(d: date) -> int:
first = date(d.year, 1, 1)
day_of_year = (d - first).days + 1
weekday_of_first = (first.weekday() + 1) % 7 # convert Mon=0 to Sun=0
return -(-(day_of_year + weekday_of_first) // 7) # ceil division
us_week(date(2026, 5, 28)) # 22
us_week(date(2027, 1, 1)) # 1
us_week(date(2026, 12, 31)) # 53
Python's date.weekday() returns Monday as 0 and Sunday as 6. The shift (first.weekday() + 1) % 7 converts to the Sunday-is-0 convention that JavaScript's getDay() uses.
Note that strftime("%U") and %W look similar but differ. Both treat dates before the first Sunday or Monday as week 0, which the US WEEKNUM rule does not.
JavaScript uses millisecond differences and Math.ceil. Month indices start at 0, so May is 4 and December is 11. Date.getDay() already returns Sunday as 0.
function usWeek(d) {
const first = new Date(d.getFullYear(), 0, 1);
const dayOfYear = Math.floor((d - first) / 86400000) + 1;
return Math.ceil((dayOfYear + first.getDay()) / 7);
}
usWeek(new Date(2026, 4, 28)); // 22 (month index 4 = May)
usWeek(new Date(2027, 0, 1)); // 1
usWeek(new Date(2026, 11, 31)); // 53
How many weeks does a US year have?
Every US year has at least 53 weeks under this formula. The 365 or 366 days of a year always span 53 Sunday-start weeks once the partial first week is counted as week 1.
Leap years where 1 January falls on a Saturday extend to 54 weeks. The next such year is 2028: 1 January 2028 is a Saturday, and 31 December 2028 sits in US week 54.
Related articles
FAQ
Why does my US week number differ from the ISO week number? US week 1 contains 1 January and starts on Sunday. ISO 8601 week 1 contains the first Thursday and starts on Monday. The rules disagree near year boundaries and on which weekday opens the week.
Does every US year have 53 or 54 weeks? Every US year has at least 53 weeks because the partial first week always counts as week 1. Leap years where 1 January is a Saturday have 54 weeks, including 2028 and 2056.
Which Excel WEEKNUM mode matches this site's US calculator?
This site's US calculator uses WEEKNUM(date, 1), the Sunday-start mode with week 1 containing 1 January. The plain WEEKNUM(date) call with no second argument returns the same result.