JSON API
Exact time answers for machines.
Two unauthenticated GET endpoints. No SDK, no timezone guessing, and CORS is enabled for browser clients.
Base URL
https://timediff.fyi/apiGET
Open UIConvert an epoch or ISO timestamp
/api/epochvalue- A numeric Unix epoch. Use this or
iso, never both. unitauto(default) uses a 100,000,000,000 threshold. Setsecondsormillisecondsfor ambiguous early dates.iso- An ISO 8601 timestamp ending in
Zor an explicit numeric offset.
Epoch → date
curl -s "https://timediff.fyi/api/epoch?value=0&unit=seconds"200 response
{
"ok": true,
"data": {
"input": 0,
"input_unit": "seconds",
"seconds": 0,
"milliseconds": 0,
"iso": "1970-01-01T00:00:00.000Z",
"utc": "Thu, 01 Jan 1970 00:00:00 GMT"
}
}Date → epoch
curl -s "https://timediff.fyi/api/epoch?iso=2026-08-22T10%3A30%3A00%2B01%3A00"GET
Open UIDifference between two timestamps
/api/difffrom- The starting ISO 8601 timestamp with
Zor a numeric offset. to- The ending ISO 8601 timestamp with
Zor a numeric offset.
curl -s "https://timediff.fyi/api/diff?from=1970-01-01T00%3A00%3A00Z&to=1970-01-02T01%3A30%3A00Z"200 response
{
"ok": true,
"data": {
"from": "1970-01-01T00:00:00.000Z",
"to": "1970-01-02T01:30:00.000Z",
"direction": "after",
"sign": 1,
"milliseconds": 91800000,
"seconds": 91800,
"human": "1 day, 1 hour, 30 minutes",
"iso_duration": "P1DT1H30M"
}
}Predictable by default
Invalid or missing inputs return HTTP 400 with a stable error object. Successful responses are cacheable; errors are not. Every endpoint accepts OPTIONS and returns Access-Control-Allow-Origin: *.
400 response
{
"ok": false,
"error": {
"code": "INVALID_TIMESTAMP",
"message": "From timestamp must include Z or an explicit offset such as +01:00."
}
}