WhatWeek

Week Number API, JavaScript & Excel Tools

Use the Week Number API, tested JavaScript examples, and Excel or Google Sheets formulas to build accurate ISO and US-style week workflows.

API quick start

GET /api/week
  ?date=2026-05-03
  &system=iso
  &timezone=Asia/Singapore
{
  "date": "2026-05-03",
  "timezone": "Asia/Singapore",
  "system": "iso",
  "weekYear": 2026,
  "weekNumber": 18,
  "iso": "2026-W18-7",
  "weekStarts": "2026-04-27",
  "weekEnds": "2026-05-03",
  "weeksInYear": 53
}

Week Number API documentation

Validate dates, timezones, week systems, and 53-week years with small JSON responses.

Use the Week Number API

JavaScript week-number guide

Use tested helpers and avoid local-time parsing bugs around late December and early January.

Calculate ISO weeks in JavaScript

Excel and Google Sheets formulas

Pick the right formula for ISO weeks, US-style weeks, and spreadsheet planning workflows.

Use Excel and Sheets formulas

JavaScript example

Use explicit calendar dates and read the week-year separately from the calendar year. The full guide explains timezone and parsing pitfalls.

For the rule itself, read the ISO week date guide.

  • Avoid parsing bare date strings through local time.
  • Keep week-year separate from calendar year.
  • Test Dec 29-Jan 4 before shipping date logic.

Fetch example

const url = new URL(
  'https://whatweek.is/api/week'
);
url.search = new URLSearchParams({
  date: '2026-05-03',
  system: 'iso',
  timezone: 'Asia/Singapore',
});

const response = await fetch(url);
const week = await response.json();

console.log(week.iso); // 2026-W18-7

Excel and Google Sheets

Use ISOWEEKNUM for ISO week numbers. Use WEEKNUM carefully because its default system can differ. The spreadsheet guide covers Excel, Google Sheets, and the common ISO vs Sunday-start mismatch.

=ISOWEEKNUM(DATE(2026,5,3))
=WEEKNUM(DATE(2026,5,3),21)

Open Excel week number guide

Edge cases to test

Always test dates around December 29 through January 4. ISO week-years can differ from calendar years around New Year.

2025-12-29
2026-W01
Calendar year and ISO week-year differ.
2026-05-03
2026-W18
A Sunday ends the ISO week.
2026-12-28
2026-W53
2026 includes an ISO Week 53.
2027-01-01
2026-W53
January 1 still belongs to the previous ISO week-year.
2027-01-04
2027-W01
The first Monday of ISO week-year 2027.

Reuse the same 17 expected results across your application and spreadsheet tests. The files include ISO week-years, week numbers, weekdays, and Monday–Sunday date ranges; no API key or sign-up is needed.

Implementation checklist

  • Parse dates as explicit calendar dates, not vague local-time strings.
  • Return the week-year separately from the calendar year.
  • Validate week 53 only for ISO years that actually have 53 weeks.
  • Show the timezone used for current-week calculations.

Verify a sample input with the Date to Week converter, or turn a validated week-year and week number into all seven dates with the Week Number to Date converter.