What is UTC — and why your date slips back a day

Look what the browser does with two almost identical strings. The first is a date only, the second a date with a time:
new Date("2026-08-20") // 20 August, 00:00 UTC
new Date("2026-08-20T00:00:00") // 19 August, 21:00 UTC (if you're in Moscow)
You added the time — and lost a whole day. You didn't remove information, you added it. That's not a browser bug; it's a rule written into the language spec.
To stop being spooked by this, you need one idea: UTC.
UTC isn't a time zone — it's the zero mark
UTC stands for Coordinated Universal Time. It's the reference scale every other time is measured from.
Not a zone — the zero on the ruler. Moscow is UTC+3, Los Angeles is UTC−7. Nobody "lives on UTC" except servers.
The old name for the same ruler is GMT. People mix them up in everyday speech, and that's fine: the difference is under a second and only matters to astronomers.
UTC's key property: it is the same everywhere and never changes the clocks. No daylight saving, no parliamentary decisions. That's why servers agreed to count in it.
One instant, two different dates
Take a moment in time: 2026-08-20T21:30:00Z. The trailing Z ("Zulu") means "this is UTC".
Show it to two people:
- in Moscow the clock reads 21 August, 00:30
- in Los Angeles it reads 20 August, 14:30
One instant. Different date. Even the month can diverge if it happens on the first.
Hence the rule that saves your nerves: a "date" isn't a property of the event, it's a property of the observer. An order has no date of its own. There's a moment, and there's someone looking at it.
That's exactly why "stats for 20 August" for you and for a user in the other hemisphere are two different sets of rows in the database.
An offset isn't a constant
It feels like you could just remember "+3" and move on. You can't.
Half the world shifts its clocks, so their offset changes twice a year. But here's the worse part: when the clocks go forward, local time literally disappears. On that night the hour between 02:00 and 03:00 doesn't exist — and in autumn the same hour happens twice instead.
Picture "03:30 local" sitting in your database for that exact night. Which moment is it? The first one? The second? Neither? There's no answer — and the question only exists because you stored local time.
In UTC this never happens. Seconds just keep going, with no clock changes and no parliamentary decisions.
That string trap
Back to the first example. Why does it behave that way?
The JavaScript spec splits two cases:
- a date-only string (
"2026-08-20") is read as UTC; - a date-and-time string with no zone (
"2026-08-20T00:00:00") is read as local time of whoever parses it.
There's no logic to hunt down here — it's a historical convention. What matters is this: a string without a zone is not a moment in time. It's a set of digits everyone reads their own way.
One character fixes it. Write Z (or an explicit +03:00 offset) and the string becomes unambiguous:
new Date("2026-08-20T00:00:00Z") // always the same instant
Store in UTC, display in local
The working pattern is simple, and it's the same almost everywhere.
Store in UTC. Good news: databases already do this. Postgres timestamptz converts incoming values to UTC and — this is the part people miss — does not remember the original zone. It doesn't store "Moscow", it stores the moment. On output it converts back to the connection's current zone.
Plain timestamp (no tz) doesn't do that — it silently ignores the zone in your input string and stores bare digits. That's half the surprises when you move between SQLite and Postgres.
Send as ISO 8601 with Z. That's the 2026-08-20T21:30:00Z format any sane API returns.
Display in the user's zone, in the browser:
new Intl.DateTimeFormat("en-GB", {
dateStyle: "short",
timeStyle: "short",
timeZone: "America/Los_Angeles",
}).format(new Date("2026-08-20T21:30:00Z"))
// "20/08/2026, 14:30"
Leave timeZone out and it uses the system one. To find out what that is, one line does it: new Intl.DateTimeFormat().resolvedOptions().timeZone returns something like "Europe/Moscow".
The same principle covers scheduled jobs and logs: UTC on the inside, local on the screen.
FAQ
Why not just store the offset, like +3?
Because offsets change. Countries shift clocks and move between zones by decree. "+3" is right today and can be wrong for that same date tomorrow. A zone name (Europe/Moscow) is a rule; an offset is only today's result of it.
What about a birthday — should that be UTC too?
No. A birthday isn't a moment in time, it's a calendar date. It has no hour, and converting it to UTC actively hurts — that's exactly how it slips a day. Store those as the string "1998-04-17" and never turn them into a time object.
What's the Z for at the end?
Z means a zero-hour offset — "Zulu" in the phonetic alphabet. It tells the reader the time is already UTC and needs no conversion. Without it the string is ambiguous, and that's where whole days go missing.
The AI Architect 2027 course: step by step from computer basics to your own app and first customers. 543 short lessons on your phone.





