Quick Answers
Why does a booking move by an hour, or even a day, when the clocks change?
Somewhere in the system a wall clock reading was treated as a fixed instant. The two are only the same thing until the offset changes, and the offset changes twice a year. A booking stored as 09:00 with no zone attached has no way to know which 09:00 it meant.
Should we not just store everything in UTC and be done with it?
For a moment that has already happened, yes. For an appointment in the future, storing only UTC throws away the rule that created it. The visitor did not ask for 14:00 UTC, they asked for 09:00 in their city, and those stop matching the moment the offset moves.
Why does this only appear twice a year?
Because the offset is stable for months at a time. Everything passes review, every test passes, and then a two week window opens in which the same code produces a different answer.
How can we test this without waiting for March?
Pin the transition dates in the test suite, and run the suite in a zone far away from UTC. Most of these bugs are invisible to anyone testing in the same time zone as the server.
The Ticket That Arrives Twice a Year
A client sends a screenshot. The booking confirmation says 09:00. The customer arrived at 08:00, or the customer arrived at 10:00, and either way somebody was standing in the wrong place at the wrong time. The database shows the correct value. The application shows the correct value. The two agree with each other and disagree with reality.
Months pass. It happens again, in the other direction, and this time the customer does not complain because the customer did not come at all.
This is the shape of most timezone dst booking bug reports. Nothing crashed, no exception was logged, and the code did exactly what it was told. The instruction was just wrong in a way that only matters for a few weeks each year.
Understanding it takes one distinction, and almost every real failure comes from losing that distinction somewhere in the stack.
Two Different Things Both Called a Time
A clock reading and a moment in time are not the same object. One is a label that humans agree on. The other is a point on a timeline that the whole world agrees on.
| Wall clock time | Instant | |
| What it names | 09:00 on 29 March in London | a fixed point on the timeline |
| Whether it is unique | No. It can be skipped or repeated | Yes |
| Where it belongs | A booking, an opening time, a recurring event | A payment, an audit log, a sensor reading |
| How it is stored | Local time plus a zone identifier | UTC, or an offset |
| What breaks it | Assuming the offset never changes | Assuming the visitor cares about UTC |
A booking is a wall clock time. The customer wants 09:00, the staff wants to open at 09:00, and if the country moves its clocks that evening then 09:00 moves with it. A payment is an instant. It happened once, it happened at a fixed moment, and no government decision should ever move it.
This is the core of timestamps vs local time: one is a coordinate, the other is a label. Systems break when a label is stored as if it were a coordinate, or the reverse.
The Four Storage Rules
Four rules cover almost every case, and a codebase that follows all four has very little left to go wrong.
- Store instants in UTC. Audit logs, payments, message timestamps and created-at columns belong in timestamptz or an explicit UTC string. They are coordinates.
- Store the zone identifier, not the offset. Europe/London is a rule that includes every future change. +01:00 is a snapshot that stops being true in October.
- Store future wall clock times as local time plus zone. A 09:00 appointment carries its own local reading and its own region, and the instant is calculated when it is needed.
- Convert at the edges only. The zone lives at the boundary where a human enters or reads a time. Inside the application, everything is either a UTC instant or a wall clock value with a zone attached.
The rule people skip is the second one, because an offset looks like it contains the same information. It does not. An offset can only describe a moment that has already been resolved, which is exactly what a booking has not.
Where Offsets Get Lost
Every production failure I have seen in this area is one of a small number of patterns. They are worth memorising because the symptoms look unrelated.
| What happened | What it looks like | Why it is wrong |
| A date string without an offset was parsed | The server time zone leaks into the result | A string with no zone is not an instant, and the parser had to assume one |
| Only the offset was stored | Correct until the next transition, wrong after it | +01:00 cannot represent a rule that changes |
| The column is a timestamp without a zone | Values drift with the server configuration | The database stores no zone and applies whatever it is given |
| The browser sent local time, the API treated it as UTC | The booking is off by the offset, often by hours | Two sides disagreed about the contract and neither said so |
| Reports group by the server’s day | Daily totals do not match the client’s day | A day boundary is a local concept |
| A CSV import carried no zone | Historic rows land in the wrong bucket | The importer had no rule for an unlabelled time |
The most expensive of these is the third. A timestamp column accepts anything you give it and returns it unchanged, so the bug is invisible until the server, the replica or the reporting tool is running in a different zone from the one that wrote the row.
The Two Transition Cases You Must Decide
There are only two, and each needs an explicit decision written down somewhere a future developer can find it.
The local time that does not exist. When clocks move forward, an hour is deleted. In America/New_York that is 02:00 to 02:59 on the second Sunday in March. In Europe/London it is 01:00 to 01:59 on the last Sunday in March. If a customer could have booked 02:30, your system must decide what that booking becomes.
The local time that happens twice. When clocks move back, an hour is repeated. A 01:30 booking in London in late October happens twice, an hour apart, and the stored value will not tell you which one the customer meant unless you recorded it.
| Case | Common choice | Why teams pick it |
| A slot that does not exist | Move the booking forward by the size of the shift | The customer still gets the next real time, and nobody is early |
| A slot that happens twice | Take the first occurrence, and show the clock change in the confirmation | It matches what the customer saw when they booked |
| A recurring 09:00 meeting | Keep it at 09:00 local and let the UTC instant move | The meeting is about the hour of the day, not the moment |
The third row is where products disagree with each other loudly. A daily stand-up at 09:00 usually wants to stay at 09:00 local. A hard deadline usually wants to stay at a fixed instant. Neither is universally correct, and the bug is usually that nobody chose.
The Shift Is Not Always One Hour
Two assumptions in this area survive review because they are true in the biggest markets and false elsewhere.
The first is that a daylight saving change is always sixty minutes. Australia/Lord_Howe shifts by thirty, so code that adds or subtracts an hour when it repairs a skipped local time will land on a time that still does not exist.
The second is that an offset is a whole number of hours. Asia/Kathmandu is +05:45 and Australia/Eucla is +08:45. Anything that divides an offset by 3600 to build the display, or multiplies an hour count into a timestamp, will be wrong there. A zone with no daylight saving at all, such as Asia/Karachi, will pass every test you write in it and prove nothing about the ones that do.
There is also the historical case that produces a whole day of drift rather than an hour. Pacific/Apia skipped an entire calendar day in December 2011 when Samoa crossed the date line. A booking system asked to display a 2011 record from that zone has to do something, and the answer is almost never in the code.
Recurring Bookings and the Scheduled Job
The dst transition scheduled job is the same bug with a longer fuse. A report that runs at 07:00 local, a reminder sent nine hours before an appointment, a nightly digest at midnight: each of these is a wall clock instruction executed by a scheduler that thinks in server time or in UTC.
Three separate problems live in that sentence.
A job scheduled by UTC time keeps its UTC time and changes its local time. If the business meant 07:00 local, the report is now an hour off twice a year, and support gets two confusing tickets annually.
A job scheduled by local time is at the mercy of whichever scheduler the host provides, and they do not agree with each other. The cron daemon documented in the Linux manual pages handles a clock change in a specific way: when the clock jumps forward it runs the jobs that would have been skipped immediately, and when it falls back it takes care not to run the same job twice. Other schedulers, including some container and platform schedulers, do neither of those things. A job that charges a card or sends an invoice cannot be written against an assumption that is only true on one implementation.
And a long-running job that overlaps the change can see the same hour twice in its own loop, so any counter or log based on the hour repeats.
The safest arrangement is a zone-aware scheduler that takes a local time and a zone identifier, plus a job that is safe to run twice anyway. The second part is not optional, because the skipping and repeating rules differ between schedulers, so the same crontab can behave differently after a platform migration.
— The instant, and the rule that produced it, stored together
CREATE TABLE bookings (
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
starts_at timestamptz NOT NULL,
local_start timestamp NOT NULL,
time_zone text NOT NULL,
CHECK (starts_at = (local_start AT TIME ZONE time_zone))
);
The check constraint earns its place because it fails loudly at insert time instead of quietly at display time, and the message points at the row rather than at a report nine months later.
Store UTC, Convert at the Edges
The phrase store utc convert at edges is repeated everywhere and still gets implemented halfway. The half that gets dropped is almost always the conversion at the output edge.
from datetime import datetime
from zoneinfo import ZoneInfo
LAGOS = ZoneInfo(“Africa/Lagos”)
LONDON = ZoneInfo(“Europe/London”)
# Input edge: the customer picked a wall clock time in their zone
local_start = datetime(2026, 3, 29, 9, 0, tzinfo=LONDON)
# Store the instant and the rule
starts_at = local_start.astimezone(ZoneInfo(“UTC”))
# Output edge: back to the business’s zone for the confirmation
shown = starts_at.astimezone(LAGOS)
Four lines, one rule: the zone object is never discarded, and the round trip is exercised by a test rather than by a customer. Note that the offset is never written by hand. If a -01:00 appears anywhere in a codebase, the next question is what it is meant to describe.
A Test Matrix That Fails Without Waiting a Year
These tests are cheap, and each one catches a different class of mistake. The timezone handling tests most teams have cover none of them, because they run on a machine set to UTC and compare two strings that were both produced by the same broken function.
| Test | What it proves |
| A 09:00 start in a zone that shifts forward, booked either side of the transition | Whether the wall clock reading survives the change |
| A local time inside the deleted hour | That the skipped-slot rule exists and is applied |
| A local time inside the repeated hour | That the stored row records which occurrence it meant |
| Round trip: local to instant to local | That the conversion is symmetric |
| Run the whole suite with the process zone set to Pacific/Kiritimati | That no code depends on the server being near UTC |
| Run it again with the process zone set to Pacific/Midway | The same, in the other direction |
| Export an event and re-import it | That the calendar format carries the zone rather than an offset |
| A recurring 09:00 meeting across a transition | Whether the rule is local time or an instant |
The two process zone runs matter more than they look. Pacific/Kiritimati is UTC+14 and Pacific/Midway is UTC-11, so between them the server clock is on a different calendar day from UTC for part of every run. Anything that quietly calls a local function to build a date will fail one of the two.
# Run the same suite from two far apart zones
TZ=Pacific/Kiritimati pytest tests/test_scheduling.py
TZ=Pacific/Midway pytest tests/test_scheduling.py
Reading the Bug When It Is Already Live
When a customer reports a booking that is booking times off by one hour, work backwards through the three places a time exists.
- The stored row. Read starts_at, local_start and time_zone together, and check whether the constraint would accept them.
- The reading of the row. Confirm which conversion produced the displayed value, and confirm that no offset was written by hand in between.
- The browser. Check what the client sent. A form that posts a local string and a form that posts an ISO instant are two different contracts, and a mismatch here produces exactly this symptom.
If all three agree, the remaining suspect is the client’s own device zone, and the question becomes whether the customer was travelling when they booked. That is a product decision, not a bug, but it is worth knowing which one you are looking at before you change any code.
What This Does Not Fix
- A customer who changes time zone between booking and attending. The booking keeps the zone it was made in. Whether that is right depends on the product.
- Calendar applications applying their own reminder logic. Once an ICS file leaves your system, the receiving app decides when to notify.
- Store reviews and platform clocks. A device with a manually set clock will disagree with everything.
- Historic data with no zone recorded. It cannot be repaired with certainty, only labelled with the assumption you are making.
- Daylight saving rules changing in the future. Governments change them, and the time zone database is updated to match. Pin it and update it deliberately.
A Checklist Before You Ship
- Every future appointment stores a local time and a zone identifier, not an offset.
- Every past event stores a UTC instant.
- No column in the schema is a timestamp without a zone.
- The skipped-hour and repeated-hour rules are written down and tested.
- Recurring meetings specify whether they follow local time or the instant.
- Scheduled jobs take a zone identifier and are safe to run twice.
- The test suite runs green in two process zones far from UTC.
- The time zone database is pinned and updated on purpose.
- Calendar exports carry a zone, not an offset.
- The API contract states whether a time field is an instant or a wall clock value, in the field name if possible.
If Scheduling Is the Core of Your Product
Time zone handling looks like a formatting problem until a customer is standing in the wrong place. Our custom software team builds booking and scheduling modules where the zone is part of the data model rather than a display trick, and our full stack development team handles the parts that touch both the browser and the database. Where the booking has to land in someone else’s system, API integration is where the contract gets written down.
Frequently Asked Questions
Is storing UTC not enough?
For something that already happened, yes. For an appointment in the future, no. UTC tells you the instant that a rule currently produces, not the rule itself. When the offset changes, the correct instant changes too, and a system that stored only UTC has no way to recalculate it.
Why not store the offset, like -05:00?
An offset describes one resolved moment. A zone identifier describes a place and every rule that applies to it, including future changes that have not happened yet. If a government moves its clocks in two years, the zone identifier still works and the offset does not.
Should a recurring 09:00 meeting move with the clocks or stay at the same UTC time?
It depends what the meeting is for, and the mistake is not choosing. A stand-up usually belongs at 09:00 local, so the UTC instant moves. A deadline belongs at a fixed instant, so the local reading moves. Write the choice next to the schedule.
Our stored times look right but the calendar invite is wrong. Why?
The invite is usually the place where the zone gets dropped. An ICS file without a TZID and a matching time zone definition leaves the receiving application to guess, and different applications guess differently. Check the exported file before you debug the database.