# ISO to epoch

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

Convert a canonical RFC 3339 UTC timestamp to an exact integer Unix epoch count in the requested unit.

**Use when you need to: ISO date to unix timestamp · RFC 3339 UTC to epoch seconds · convert UTC time to milliseconds.**

## Decide before calling

Read the [versioned contract](/v1/tools/iso-to-epoch/versions/1.0.0) and the supported scope below. Reuse `iso-to-epoch@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `iso-to-epoch@1.0.0` for ISO date to unix timestamp. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- ISO date to unix timestamp
- RFC 3339 UTC to epoch seconds
- convert UTC time to milliseconds
- timestamp string to epoch nanoseconds
- get microseconds since 1970
- turn ISO timestamp into integer

## Not supported

- non-UTC offsets
- natural-language dates
- leap-second timestamps

## Behavior

- Accept canonical UTC form YYYY-MM-DDTHH:mm:ss[.fraction]Z only, with 1 to 9 fraction digits.
- Apply the POSIX rule that every day has exactly 86400 seconds; reject RFC 3339 leap-second spelling :60.
- Require exact divisibility at the requested unit, so no rounding or truncation occurs.

## Input

- `iso` (string, required): min length 20; max length 30
- `unit` (one of "seconds", "milliseconds", "microseconds", "nanoseconds", required)

## Output

- `epoch` (string, required): min length 1; max length 21; pattern `^-?[0-9]+$`
- `unit` (one of "seconds", "milliseconds", "microseconds", "nanoseconds", required)
- `standard_version` (constant "POSIX.1-2024 4.19; RFC 3339", required)

## Limits

- max input bytes: 61

## Example

Request input:

```json
{
  "iso": "1970-01-01T00:00:00Z",
  "unit": "seconds"
}
```

Response:

```json
{
  "result": {
    "epoch": "0",
    "unit": "seconds",
    "standard_version": "POSIX.1-2024 4.19; RFC 3339"
  }
}
```

## How to call it

### MCP

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

```json
{
  "id": "iso-to-epoch",
  "version": "1.0.0",
  "input": {
    "iso": "1970-01-01T00:00:00Z",
    "unit": "seconds"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/iso-to-epoch/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"iso":"1970-01-01T00:00:00Z","unit":"seconds"}'
```

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

### CLI

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

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

## Related tools

- [Duration application check](/tools/duration-application-check): Check a claimed timestamp from adding or subtracting an ISO 8601 duration under explicit offset and month-end rules.
- [Duration parse clock](/tools/duration-parse-clock): Parse an hh:mm:ss[.fraction] duration and return the exact nonnegative whole or decimal second count.
- [Duration format clock](/tools/duration-format-clock): Format a nonnegative whole or decimal second count as an exact hh:mm:ss[.fraction] clock duration.
- [ISO duration structure check](/tools/iso-duration-structure-check): Check a claimed reading of an ISO 8601 duration: well-formedness, components and month/day/time totals.
- [ISO date to week](/tools/iso-date-to-week): Convert a YYYY-MM-DD calendar date to an ISO-8601 week date.
- [ISO date-time add seconds](/tools/iso-datetime-add-seconds): Add a signed whole-second delta to a strict UTC ISO-8601 datetime.
