All Articles
JSON & APIs·5 min read·October 2, 2026

Handling Dates and Timestamps in JSON: ISO 8601 vs Epoch

Because JSON has no native Date data type, discover the best practices for representing dates using ISO 8601 strings and Unix timestamps.

TBy Toolstack Engineering
Recommended Free Tool

Try Toolstack's JSON Validator

Free, instantaneous, and processes 100% locally in your browser.

Open JSON Validator

Standard JSON defines numbers, strings, booleans, arrays, objects, and null, but intentionally omits a Date type. Developers must choose between ISO 8601 strings and Unix timestamps.

The Best Practice: ISO 8601 Strings in UTC

Example: `"createdAt": "2026-10-02T18:00:00.000Z"`

Advantages: - Human readable when inspecting API network traffic. - Parses reliably in JavaScript (`new Date("...")`), Python (`datetime.fromisoformat`), and Java. - Explicitly specifies the timezone (always use `Z` for UTC).

Unix Epoch Timestamps (Milliseconds)

Example: `"timestamp": 1790964000000`

Advantages: Extremely compact, easily sortable numerically, no string parsing overhead. However, always document whether your API uses seconds or milliseconds to prevent 1970 date bugs!

Tags:#Dates#ISO 8601#Timezones#APIs

More Guides in JSON & APIs