Lesson 3
UTC, Local Time, and Timezones
Wall clock vs instant, IANA zones, and daylight saving shifts.
A Unix timestamp identifies an instant—one point on the global timeline. UTC and local time are different ways to label that instant for humans.
UTC
Coordinated Universal Time (UTC) is the reference timescale without seasonal offsets. When logs say “all times in UTC,” comparisons across regions do not require guessing local rules.
ISO strings ending in Z mean “Zulu” = UTC, e.g. 2024-01-15T08:30:00Z.
Local wall time
Your laptop clock shows local wall time—the civil time in your timezone, including daylight saving adjustments. Two developers looking at the same timestamp may write different clock readings:
2024-07-01 09:00inEurope/Berlin2024-07-01 15:00inAsia/Shanghai
Both can describe the same instant.
IANA timezone names
Systems use names like America/New_York or Asia/Tokyo (IANA Time Zone Database). These names encode historical offset changes—prefer them over fixed “UTC+8” labels when scheduling future events across DST boundaries.
Offset alone is not a timezone. UTC+8 on a given day may not tell you what happens when DST rules differ by country.
Storage vs display
Best practice in backends:
- Store UTC instant (timestamp or
TIMESTAMPTZ) - Convert to local timezone only in UI or user-specific reports
Key takeaway
Timestamps store when; timezones decide how you read the clock. Always know which layer you are looking at.