Unix timestamp vs ISO 8601: which date format to store?
Both represent an instant in time, but one is a raw number and the other a structured string. The right choice depends on who — or what — reads it.
| Unix timestamp | ISO 8601 | |
|---|---|---|
| Example | 1700000000 | 2023-11-14T22:13:20Z |
| Human-readable | No | Yes |
| Timezone | Always UTC (implicit) | Explicit (Z or offset) |
| Lexically sortable | Yes (numeric) | Yes (string sort) |
| Arithmetic | Trivial (subtract numbers) | Needs parsing |
| Best for | Internal storage, math | APIs, logs, anything humans read |
Readability vs convenience
A Unix timestamp is great for the machine — compact, trivially sortable, and time differences are plain subtraction. But 1700000000 tells a human nothing, and a units mistake (seconds vs milliseconds) silently breaks it.
ISO 8601 (2023-11-14T22:13:20Z) is self-describing and includes its timezone, so logs and API responses are debuggable at a glance. The trade-off is you must parse it to do date math.
A common pattern
Many systems store or transmit ISO 8601 for clarity and convert to a timestamp only when doing arithmetic. APIs increasingly prefer ISO strings for exactly this reason. Convert between both in the Timestamp Converter.
The verdict
Prefer ISO 8601 for APIs, logs, and anything a human might read — it is unambiguous and carries its timezone. Use a Unix timestamp for compact internal storage and easy time math. Convert freely in the Timestamp tool.
Frequently asked questions
- Should APIs return Unix timestamps or ISO 8601?
- ISO 8601 is generally preferred for APIs: it is human-readable, self-describing, and includes the timezone, which makes debugging far easier.
- Are both formats sortable?
- Yes. Unix timestamps sort numerically; ISO 8601 strings sort correctly with a plain string sort because the fields go from largest to smallest unit.
- Does ISO 8601 include a timezone?
- It can and should — a trailing Z means UTC, or an offset like +07:00. Unix timestamps are always implicitly UTC.
Try it yourself
Free, in-browser tools for everything above.