Why UTC is the Only Standard
Time is a human construct, but timezones are a political one. When building distributed systems, relying on local time introduces fatal race conditions.
Coordinated Universal Time (UTC) is not a timezone; it is a time standard. It does not observe Daylight Saving Time. It is monotonic (mostly, ignoring leap seconds). It is predictable.
ISO 8601
2024-03-15T14:30:00Z
The 'Z' stands for Zulu time, synonymous with UTC.
The Database Law
Never, under any circumstances, store local time in a database. Store UTC. Transform to local time only at the presentation layer (the browser or client). This ensures that an event recorded in Tokyo can be accurately sorted against an event recorded in London.
Common Anti-Patterns
- "We only operate in one timezone." - Until you hire a contractor, open a new office, or sell the company.
- Storing offset integers. - Offset is not timezone. New York is -5 or -4 depending on the date. Store the standard identifier (e.g.,
America/New_York) alongside the UTC timestamp if local context is needed.