flashman
← All guides

Unix timestamps and ISO dates: conversion guide

Convert epoch seconds, milliseconds, and ISO-8601 strings without timezone bugs.

2026-06-05 · 5 min read

  • time
  • api

Unix time counts seconds since 1970-01-01 UTC. JavaScript Date.now() returns milliseconds. APIs mix both, which causes off-by-three-orders-of-magnitude bugs in log parsers and mobile clients.

Seconds vs milliseconds

If a timestamp looks like year 50000+, you probably multiplied seconds twice.

  • 1704067200 — seconds (10 digits) — common in Unix APIs
  • 1704067200000 — milliseconds (13 digits) — JavaScript native

ISO-8601 strings

Prefer ISO strings with explicit offsets (2026-06-05T12:00:00Z) in JSON APIs. Ambiguous local strings without timezone cause daylight-saving bugs.

Debugging logs

Paste raw epoch values from log lines into a converter to compare with human incident timelines. Always note whether the source system logs UTC or local time.

Try these tools