Calculate week number

Convert a Gregorian date to its ISO week-year or expand an ISO week into Monday-through-Sunday dates.

freeworks offlinenothing uploaded
ToolWeek Number Calculator
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

The week’s Thursday determines its ISO year, while reverse lookup anchors week 1 to the week containing 4 January. Checking 28 December rejects week 53 in an ISO year that contains only 52 weeks.

  • ISO weeks always begin Monday and can cross calendar-year boundaries.
  • No current date is assumed, keeping every lookup reproducible.

Worked example

A date at the year boundary
Late December that already belongs to next year's week 1
Input
											2018-12-31
										
Output
												ISO year: 2019
ISO week: 1
Week start: 2018-12-31
Week end: 2019-01-06
											

When to use this

Business reports group by ISO week, manufacturing plans expand week labels, and boundary tests cover late-December week years.

Edge cases

  • 2018-12-31 is ISO week 1 of 2019 despite its Gregorian year.
  • Week 53 is rejected when 28 December proves that ISO year ends at week 52.
  • Sunday is the final day of its Monday-starting ISO week.

References