Measured on PostgreSQL 18.4: timestamp keeps digits, timestamptz keeps an instant. Session zones change casts and days, and London 01:30 repeats in October.
The order was paid at half past nine, or at four
Belgavi's Book Store records when each order was paid. The orders table has two columns that look interchangeable: paid_local timestamp, added years ago by the shop's billing screen, and paid_at timestamptz, added later by the web checkout. Geetha, working from Bengaluru, writes a payment at 09:30 on 19 November 2026. Dinky reads the same row from a report server in London, and a nightly export runs on a machine set to New York time.
The probe in the companion inserted exactly that row on PostgreSQL 18.4 from a session whose TimeZone was Asia/Kolkata, then read it back from three sessions:
| Session TimeZone | timestamp column | timestamptz column | epoch of timestamptz |
|---|---|---|---|
| Asia/Kolkata | 2026-11-19 09:30:00 | 2026-11-19 09:30:00+05:30 | 1795060800 |
| Europe/London | 2026-11-19 09:30:00 | 2026-11-19 04:00:00+00 | 1795060800 |
| America/New_York | 2026-11-19 09:30:00 | 2026-11-18 23:00:00-05 | 1795060800 |
The timestamptz value is one instant, rendered three ways. The timestamp value is the same nine-thirty everywhere, which is correct for what it is and wrong for what most people think it is.
What each type stores
The PostgreSQL documentation is short and exact on this. timestamp without time zone stores a date and a time of day, nothing else. If the input literal contains a zone or offset, it is silently ignored. timestamp with time zone stores an instant, internally in UTC. On input, a literal without an offset is interpreted in the session's TimeZone; on output, the value is converted to the session's TimeZone for display. The zone used on input is not stored. Both types take eight bytes, and the probe confirms it.
So the names mislead in both directions. timestamptz does not store a time zone; it stores an instant and uses a zone at the edges. timestamp does not store a time in any zone; it stores calendar digits, and every query that turns them into an instant must supply the zone.
The probe's second insert makes the input rule visible. In a UTC session it writes '2026-11-19 09:30:00+05:30' into both columns. The timestamptz column reads 04:00:00+00, the right instant. The timestamp column reads 09:30:00: the offset was discarded without a warning.
Where the session zone leaks into results
Because a timestamp has no zone, PostgreSQL fills one in from the session whenever it must compare or convert the two types.
- Casts.
ts::timestamptzinterprets the digits in the session zone. The same stored 09:30 became an instant 5.5 hours earlier in anAsia/Kolkatasession than in a UTC session. - Comparisons.
ts = tstzperforms that cast implicitly. For the first row it was true in anAsia/Kolkatasession and false in a UTC session. A report that joins the two columns gives different answers depending on which server runs it. - Epoch.
extract(epoch from ts)treats the digits as if they were UTC, giving 1795080600; for thetimestamptzit gives the true instant, 1795060800. Code that converts either column to Unix time needs to know which it has. - Calendar days. Four synthetic orders were paid at 18:10, 19:05 UTC on the 18th and 02:00, 20:00 UTC on the 19th. Grouped by
paid_at::date, a UTC session counts two orders on each day; anAsia/Kolkatasession counts one on the 18th, two on the 19th and one on the 20th. Neither is wrong, but a daily sales report must choose its zone on purpose.
The safe form names the zone in the query instead of inheriting it:
select (paid_at at time zone 'Asia/Kolkata')::date as shop_day, count(*)
from orders
group by 1
order by 1;The probe ran that query in a UTC session and got the same counts as the Asia/Kolkata session.
AT TIME ZONE goes in opposite directions
AT TIME ZONE is the tool for these conversions, and it is easy to apply backwards. Applied to a timestamp, it says: these digits are local time in that zone, give me the instant, so it returns timestamptz. Applied to a timestamptz, it says: show me the local digits in that zone, so it returns timestamp.
select timestamp '2026-11-19 09:30:00' at time zone 'Asia/Kolkata';
-- 2026-11-19 04:00:00+00 in a UTC session: an instant
select timestamptz '2026-11-19 04:00:00+00' at time zone 'Asia/Kolkata';
-- 2026-11-19 09:30:00: local digitsApplying it twice to a timestamp returns the original digits, which is why a double conversion often survives testing in one zone and fails in another.
There is a second trap in the zone argument. A string such as '+05:30' is read as a POSIX-style zone specification, and POSIX offsets have the opposite sign to ISO 8601: positive means west of Greenwich. The probe converted the instant 04:00 UTC with at time zone '+05:30' and got 2026-11-18 22:30, eleven hours from the intended answer. Using a named zone ('Asia/Kolkata') or an interval (interval '+05:30', which gave 09:30) avoids the inversion. Named zones are better anyway, because they carry daylight-saving rules.
The hour that does not exist and the hour that repeats
Europe/London moved its clocks forward at 01:00 on 29 March 2026 and back at 02:00 on 25 October 2026. Local times near those transitions are where timestamp columns lose information.
In spring, 01:30 local did not exist. Asked for timestamp '2026-03-29 01:30' at time zone 'Europe/London', PostgreSQL 18.4 returned 01:30 UTC, an instant whose London local time was 02:30. No error is raised.
In autumn, 01:30 local happened twice, at 00:30 UTC and at 01:30 UTC. Both instants render as the same timestamp value, 2026-10-25 01:30:00, so a timestamp column cannot tell them apart. Converting the ambiguous local time back to an instant returned 01:30 UTC, the second occurrence. A refund recorded at 01:40 the first time round would sort after a cancellation recorded at 01:10 the second time round.
That day was 25 hours long, which also changes interval arithmetic. In a London session, starting from noon on 24 October, adding interval '1 day' gave noon on the 25th (12:00+00), and adding interval '24 hours' gave 11:00+00. Day intervals follow the calendar; hour intervals follow the clock. Billing periods, return windows and reminders should say which they mean.
Which type to use
Use timestamptz for anything that happened at a moment: payments, events, log lines, deadlines that are instants. Store the zone name separately, in a text column, when you need to know the local context, such as the shop where an order was placed.
Use timestamp only for wall-clock values that are not instants yet, such as "the shop opens at 09:00 local" or a recurring schedule in a named zone. Always pair it with a zone column and convert with AT TIME ZONE at the point of use.
When migrating an existing timestamp column, the conversion needs the zone the digits were written in: alter table orders alter column paid_local type timestamptz using paid_local at time zone 'Asia/Kolkata'. If different rows were written in different zones, convert row by row from a zone column. Expect ambiguous rows near autumn transitions; they need a business decision, not a cast.
Failure modes to test
- Application servers and database sessions with different default zones. Set
TimeZoneexplicitly in the connection string or pool configuration and assert it in a health check. - Drivers that convert values on the client. Some map
timestampto a local date-time type andtimestamptzto an instant type; check what yours does with each. - Reports run from a different server zone. Run one report from two zones in CI and compare.
- Offset strings in configuration. Grep for
at time zone '+andat time zone '-.
Verification
python -m unittest -v test_example.py in the companion checks the recorded PostgreSQL 18.4 output with the standard library only. With PG_DSN pointing at a scratch database, the same command reruns probe.py and requires identical results, so you can confirm your server version and tz database behave the same way.