TIME ZONESStore UTC, show local timeTimes show an hour out after the clocks change. A daily reminder that used to arrive at 09:00 now lands at 08:00. A due date appears as the day before for customers abroad. These bugs look unrelated, but they usually share one cause: the app treats every date and time value the same way. Here is how we set it up, in terms a founder can brief and a developer can build from.
What kinds of time does your app store?
Most apps store three kinds of time value, and each needs its own type.
- Instants: a moment that is the same everywhere, such as when an invoice was paid. Store these in UTC.
- Local times in a named zone: a time people mean on their own clock, such as 09:00 every weekday in
Europe/Berlin. Store the clock time and the zone name. - Dates: a day with no time attached, such as a birthday or a contract end date. Store these as a date, not a timestamp.
How should the database store instants?
As UTC, in a column type that knows it holds an instant. In PostgreSQL that is timestamp with time zone, usually written timestamptz. Despite the name, it does not keep a zone: PostgreSQL converts the input to UTC, stores UTC and converts back to the session's TimeZone setting on output. The plain timestamp without time zone type silently ignores any zone or offset in the input.
-- PostgreSQL: an instant, stored as UTC
paid_at timestamptz NOT NULL
// JavaScript: show it on the viewer's clock
new Intl.DateTimeFormat("en-GB", {
dateStyle: "medium",
timeStyle: "short",
timeZone: "Europe/Berlin", // the user's saved zone
}).format(new Date("2026-11-10T14:30:00Z")); // 15:30 in BerlinIn API payloads, send instants as RFC 3339 strings, the internet profile of ISO 8601, ending in Z or a numeric offset, for example 2026-11-10T14:30:00Z. In JavaScript, toISOString() always returns UTC with a Z.
Why keep a time zone name instead of an offset?
Because an offset is only true for part of the year, while a name carries the rules. New York is UTC-5 in winter and UTC-4 during daylight saving time, so a saved offset is wrong for months at a time. Names from the IANA time zone database, such as America/New_York, stand for a place's history of offsets and daylight saving rules, and the database is updated when governments change them. Keep the name:
- On each user, for their own screens, emails and reminders.
- On each workspace, for anything shared, such as a weekly report or an end-of-day cut-off.
- As a default at sign-up: in the browser,
Intl.DateTimeFormatreports the zone name throughresolvedOptions().timeZone, and the user can change it in settings.
How should the app show times to each user?
Convert at the moment of display, using the viewer's saved zone. Intl.DateTimeFormat accepts any IANA zone name in its timeZone option. Leave the option out and it uses the runtime's own zone, which on a server is the server's zone, not the customer's. So server-rendered pages, emails and PDFs show server time unless you pass the zone. Pass it everywhere you format a time, and on shared screens show the zone next to the time.
Why do reminders fire at odd hours?
Usually because the schedule was saved as a fixed UTC time or offset, so when daylight saving starts or ends, the reminder moves by an hour on the user's clock. Save the rule as the user said it, such as 09:00 on weekdays in America/New_York, and calculate each next run's UTC instant from that rule. Three details need a decision in the spec:
- Days are not always 24 hours. PostgreSQL's documentation shows that in
America/Denver, addinginterval '1 day'across a daylight saving change keeps 12:00, whileinterval '24 hours'lands on 13:00. - Some local times never happen and some happen twice. In New York on 10 March 2024 the clock went from 01:59 to 03:00, and on 3 November 2024 the hour from 01:00 repeated. JavaScript's
Datemoves a missing time forward and picks the earlier of two repeated ones. Decide whether that suits a reminder set for 02:30. - Rules can change before a future event. For a meeting months away, keep the local time and zone next to the instant, so you can recalculate if the rules change.
How should birthdays and due dates be stored?
As dates, with no time and no zone. PostgreSQL's date type holds a day with no time of day. If a due date is saved as midnight UTC instead, anyone in a zone behind UTC sees the day before. JavaScript has a related trap: a date-only string such as "2026-03-01" is parsed as midnight UTC, so formatted in New York it reads 28 February. Send dates in APIs as plain YYYY-MM-DD strings, and decide whether something is overdue by comparing it with today's date in the user's or workspace's zone.
Before release, add tests with a user in a zone far from your team's, and with dates on the days the clocks change in that zone.
Where to start
Ask your developers to list every date and time field and scheduled job, and label each one: instant, local time with a zone, or date. Fix anything stored in the wrong type, add a time zone setting to users and workspaces, and pass an explicit zone wherever a time is formatted. Changing column types on a live database needs care, which we cover in changing a live SaaS database. If you would like this reviewed or built, our web app development service builds Next.js apps on Postgres.
FAQ
Frequently asked questions
Should our servers run on UTC?
It can make logs easier to read, but the app should not depend on it. With timestamptz, PostgreSQL stores UTC whatever the server's setting and converts to the session's time zone only on output. In code, pass an explicit zone whenever you format a time, because Intl.DateTimeFormat otherwise falls back to the runtime's default zone.
Can we save the user's UTC offset instead of a time zone name?
No. An offset describes one moment, not a place. A zone with daylight saving has two offsets during the year, and countries sometimes change their offset altogether. A named zone such as America/New_York lets the app work out the correct offset for each date from the zone's known rules, which an offset on its own cannot do.
What happens to existing data when a user changes their time zone?
Instants need no change: they are stored in UTC, and the app simply displays them in the new zone. Recurring reminders are the real decision. Either they follow the user to the new zone, so 09:00 stays 09:00 on their clock, or they keep the old zone. Choose one, explain it in settings, and recalculate the next run when the zone changes.
Do time zone rules ever change?
Yes. The IANA time zone database is updated periodically to reflect changes by governments to zone boundaries, UTC offsets and daylight saving rules. PostgreSQL uses this database for its zone rules and assumes the latest known rules continue into the future. Keep the software that carries these rules up to date, and expect future local times to need recalculating occasionally.
Is the JavaScript Temporal API ready to use?
Check before you rely on it. MDN lists Temporal as limited availability, not Baseline, because it does not work in some of the most widely used browsers. Its types match the three kinds of time value well: Temporal.Instant, Temporal.ZonedDateTime for a time in a named zone, and Temporal.PlainDate for a date with no time or zone.
