Timestamp & Epoch Converter
Convert between epoch seconds, milliseconds, and human-readable ISO dates with clear timezone context. Stop guessing whether a JSON field is in seconds or ms.
Try it now: Open the free Timestamp & Epoch Converter tool — no sign-up required.
Why instants, civil time, and offsets are three different things
An instant is a point on the physical timeline. Civil time (calendar date + wall clock) depends on a government-defined timezone rule set that changes with legislation. The offset from UTC for “America/Chicago” is not constant—DST shifts it twice a year. Converting a timestamp “to local” requires a zone database, not a fixed arithmetic offset. Tools that only add -06:00 without IANA semantics will be wrong across DST boundaries.
Unix timestamps in API design
Prefer ISO 8601 strings in JSON for human readability and forward compatibility, or document numeric epoch with explicit unit (epoch_ms vs epoch_s). If you emit both, ensure they round-trip identically. For ordering and range queries, numeric epoch in milliseconds is compact; for audit logs you read in a terminal, ISO wins. When debugging nested API responses, paste into JSON Formatter to align fields before comparing timestamps across services.
ISO 8601 nuances that break naive parsers
Omitting timezone implies local interpretation in some contexts and UTC in others—RFC 3339 (a practical profile) encourages explicit Z or offsets. Fractional seconds vary in precision; trimming trailing zeros changes string equality but not the instant. Week dates (2026-W13-6) and ordinal dates appear in specs but rarely in web APIs—stick to calendar date + time for interoperability.
Testing and correlation with IDs and hex
Distributed traces often pair trace_id with epoch milliseconds. When inspecting raw binary or hex-encoded telemetry, Hex Converter helps decode packed structs where time is only one field. For unique event keys, UUID Generator produces v4 random IDs; UUID v7 embeds sortable time—know which you need before correlating logs.
Practical habits for application code
Use the platform’s timezone-aware types (Instant, ZonedDateTime, Temporal, etc.) instead of stuffing local strings into SQL without offsets. Serialize to UTC at boundaries; test DST transition days with automated cases. Document whether your API’s numeric fields are seconds or milliseconds once—future you and every client will thank you.
Leap seconds, smearing, and monotonic time
POSIX time usually ignores leap seconds; wall clocks and NTP may “smear” adjustments across hours so second counts stay monotonic at the expense of slightly stretched seconds—behavior differs by OS and distro. For correlating audit logs across heterogeneous servers, prefer ISO strings with explicit offsets from systems sharing the same policy, or scientific TAI-derived timestamps if your domain mandates them—rare in typical web stacks. Never use civil timestamps for duration or latency: DST jumps and manual corrections corrupt deltas. Use monotonic clocks (CLOCK_MONOTONIC, performance.now()) for rate limits, benchmarks, and timeouts. When logs embed IDs alongside instants, generate correlators with UUID Generator and pretty-print JSON bundles with JSON Formatter before diffing environments.
Frequently Asked Questions
- What is the Unix epoch?
- It is midnight UTC on 1970-01-01, the reference point from which POSIX time counts seconds (ignoring leap seconds in the usual `time_t` sense). Positive values are after that instant; negative values represent times before 1970 in UTC-based libraries.
- Should I store UTC or local time in databases?
- Store UTC instants (or a TIMESTAMP WITH TIME ZONE that normalizes to UTC) and convert to local zones at display. Storing local civil time without offset causes ambiguous clocks during DST jumps and cross-region bugs. APIs should emit ISO 8601 with explicit offsets or `Z` for UTC.
- What is ISO 8601 and why do APIs use it?
- ISO 8601 strings like `2026-03-28T15:30:00Z` or `2026-03-28T10:30:00-05:00` encode calendar date, time of day, and UTC offset unambiguously. They sort lexicographically when using the same precision and offset convention—handy for logs and JSON fields.
- Are Unix timestamps in seconds or milliseconds?
- Unix `time_t` traditionally counts whole seconds; JavaScript `Date.now()` and many JSON APIs use milliseconds since epoch. Mixing them off by 1000× is a common bug—your tool should label units clearly. Some systems use microseconds in protobuf or logs—always read the spec.
- What is the Year 2038 problem?
- Signed 32-bit seconds-since-epoch overflows after `03:14:07 UTC on 19 January 2038`. Systems still using `int32` for timestamps need migration to 64-bit or string instants. New code should use 64-bit integers or ISO strings end to end.
Ready to try it yourself?
Use Timestamp & Epoch Converter for Free