UTC vs Local Time for Timestamps: Which Should You Use?
Always store timestamps in UTC. Display them in local time. This one rule eliminates an entire class of timezone bugs.
What goes wrong with local time storage
When you store a local timestamp — say 2026-03-08 02:30:00 in the US Eastern timezone — you lose critical context:
- Daylight saving time shifts happen at 2:00 AM. That exact time is ambiguous: it could be EST (UTC−5) or EDT (UTC−4) depending on direction.
- A server in UTC+0 and a user in UTC+9 will disagree on what "now" means if both read a raw local timestamp without an offset.
- Log files from multiple services in different regions become impossible to sequence correctly.
UTC removes ambiguity
UTC (Coordinated Universal Time) has no timezone offset and no daylight saving shifts. A UTC timestamp like 2026-03-08T07:30:00Z means one specific moment in time, everywhere on earth.
// Store UTC (the Z suffix means UTC)
const stored = new Date().toISOString(); // "2026-06-22T14:30:00.000Z"
// Convert to local time only at display time
const local = new Date(stored).toLocaleString("en-US", {
timeZone: "America/New_York"
});
When local time is appropriate
There are two legitimate cases for storing local time:
- Calendar events with a specific location — a meeting at "9 AM Denver time" should stay at 9 AM even if UTC offsets change (e.g., during daylight saving transitions). Store the local time and the IANA timezone name (
America/Denver). - Business rules tied to a clock — "send reminder at 9 AM in the user's timezone" requires knowing the user's timezone separately regardless.
In both cases, store enough context to reconstruct the intent — not just a raw local time with no offset.
How to convert timestamps
Paste any Unix timestamp or ISO 8601 string into the timestamp converter to flip between UTC, Unix time, and local time. Useful for debugging log entries or decoding API responses.
For the difference between Unix seconds and milliseconds — which trips up almost everyone at least once — see Unix time: seconds vs milliseconds. For ISO 8601 format specifics, see ISO 8601 date format explained.
Got a config file to check?
Open the config toolkit →