Snipget.ai

Convert between Unix epoch and datetime

Exact
dates_timestamp

Deterministic and authoritative — the canonical answer for this input.

Convert between a Unix epoch and an ISO 8601 datetime, both ways. 'auto' reads a numeric input as an epoch and any other string as ISO. Always returns epoch_s, epoch_ms, and iso_utc. unit is 's' or 'ms'. Processing multiple inputs? Use `dates_timestamp_batch` to do up to 1000 in one call.

Parameters

valuestringrequired

A Unix epoch or an ISO 8601 datetime.

unitstringoptional

Epoch scale: 's' (seconds) or 'ms' (milliseconds).

directionstringoptional

'auto' (numeric→datetime, ISO→epoch), 'to_epoch', or 'to_datetime'.

Call it

curl -X POST https://api.snipget.ai/v1/dates/timestamp \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"value":"1700000000"}'

The Batch tab sends up to 1000 inputs in one call via /v1/dates/timestamp/batch.

Example response

{
  "input": "1700000000",
  "is_valid": true,
  "direction": "to_datetime",
  "epoch_s": 1700000000,
  "epoch_ms": 1700000000000,
  "iso_utc": "2023-11-14T22:13:20+00:00"
}

FAQ

What is a Unix timestamp and why convert it?

Many systems store dates as a single big number counting seconds since 1970, like 1700000000. This tool turns that number into a readable date and back again, so you do not have to do the math.

Does it work both directions?

Yes. By default it auto-detects: a number becomes a date, and an ISO date becomes a number. You can force it with direction set to to_epoch or to_datetime. It always returns both forms in the result.

My timestamps are in milliseconds, not seconds.

Set unit to ms. Some systems use milliseconds (a 13-digit number) instead of seconds (10 digits). The output always includes both epoch_s and epoch_ms regardless.

Is the conversion exact?

Yes. It is deterministic and authoritative, and dates are always returned in UTC so there is no ambiguity about which clock the number refers to.

What if the value is not a real timestamp or date?

You get confidence 0 with a why_invalid reason instead of an error. Check is_valid before using the result.

Related tools