# ISO date to week

`iso-date-to-week` · version 1.0.0 · Dates & times (UTC, ISO 8601) · free, no key needed

Convert a YYYY-MM-DD calendar date to an ISO-8601 week date.

**Use when you need to: iso date to week · convert calendar date to iso week date · iso week year week and weekday.**

## Supported

- iso date to week
- convert calendar date to iso week date
- iso week year week and weekday

## Not supported

- locale week numbers
- Sunday-first weeks
- ISO ordinal dates
- timezones
- datetime input
- fiscal weeks

## Behavior

- Input date is a strict YYYY-MM-DD proleptic Gregorian UTC calendar date with year 0001-9999.
- ISO weeks start on Monday. Week 1 is the week that contains the first Thursday of the ISO week-numbering year.
- The ISO week-numbering year may differ from the calendar year near 1 January.
- Output year, week, and weekday are JSON integers. weekday is 1=Monday through 7=Sunday.
- iso is YYYY-Www-D with a zero-padded year and week (for example 2026-W02-4).

## Input

- `date` (string, required): min length 10; max length 10; pattern `^\d{4}-\d{2}-\d{2}$`

## Output

- `year` (integer, required): min 1; max 9999
- `week` (integer, required): min 1; max 53
- `weekday` (integer, required): min 1; max 7
- `iso` (string, required): pattern `^\d{4}-W\d{2}-[1-7]$`

## Limits

- year min: 1
- year max: 9999
- date length: 10

## Example

Request input:

```json
{
  "date": "2026-01-08"
}
```

Response:

```json
{
  "result": {
    "year": 2026,
    "week": 2,
    "weekday": 4,
    "iso": "2026-W02-4"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "iso-date-to-week",
  "version": "1.0.0",
  "input": {
    "date": "2026-01-08"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/iso-date-to-week/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"date":"2026-01-08"}'
```

The machine-readable contract is at [/v1/tools/iso-date-to-week/versions/1.0.0](/v1/tools/iso-date-to-week/versions/1.0.0).

### CLI

```sh
node cli.mjs run iso-date-to-week 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [ISO week to date](/tools/iso-week-to-date): Convert an ISO-8601 week date to a YYYY-MM-DD calendar date.
- [ISO date add months](/tools/iso-date-add-months): Add a signed month count to a YYYY-MM-DD date, clamping the day to the target month.
- [ISO date add years](/tools/iso-date-add-years): Add a signed whole-year delta to a YYYY-MM-DD date, clamping the day if 29 February has no match.
- [ISO date business day add](/tools/iso-date-business-day-add): Add a signed count of business days to a date, skipping caller-supplied weekend weekdays and holidays.
- [ISO date from day of year](/tools/iso-date-from-day-of-year): Convert a calendar year and ordinal day number (1-366) to a YYYY-MM-DD date.
- [ISO date quarter bounds](/tools/iso-date-quarter-bounds): Return the calendar quarter number and the first/last dates of the quarter containing a date.
