Time measurement in computing relies heavily on the Unix epoch, defined as 00:00:00 Coordinated Universal Time (UTC) on Thursday, January 1, 1970. A Unix timestamp simply counts the number of seconds that have elapsed since this exact moment, explicitly ignoring leap seconds. For example, the timestamp 1691060000 represents exactly 1,691,060,000 seconds after the epoch.
The primary advantage of Unix timestamps is their simplicity; they are just integers. This makes mathematical operations like calculating time differences or comparing dates incredibly efficient and immune to timezone complexities. However, they lack human readability and cannot intrinsically represent historical dates prior to 1970 without resorting to negative numbers.
The precision and structure of ISO 8601
ISO 8601 is an international standard for representing dates and times as strings, designed to be unambiguous and easily parsed by both machines and humans. A standard format looks like '2026-08-03T15:30:00Z'. The 'T' separates the date from the time, and the 'Z' indicates 'Zulu' time, meaning the time is strictly in UTC with zero offset.
Unlike raw timestamps, ISO 8601 can represent timezones directly, such as '2026-08-03T15:30:00+02:00'. This format is highly recommended for APIs and data interchange formats like JSON, where clarity and explicit timezone offset information are paramount. It ensures that the receiving system understands both the absolute point in time and the local context of the originating system.
Why UTC is the gold standard for storage
A fundamental best practice in database design and server architecture is to store all dates and times exclusively in UTC, either as Unix timestamps or UTC-normalized ISO 8601 strings. Storing local time is a notorious source of bugs, especially concerning Daylight Saving Time (DST) transitions, where a local hour might happen twice or be skipped entirely.
Timezones are inherently presentation-layer concerns. By storing a definitive, continuous UTC timestamp in the backend, the frontend application can query the user's local timezone configuration and format the date appropriately for display. This decoupling ensures data integrity while providing localized experiences across the globe.