SQL: TIMESTAMP has no timezone, TIMESTAMPTZ does

TIMESTAMP stores wall-clock digits with no reference point, so the same value means a different instant in every zone. TIMESTAMPTZ stores an instant and renders it in the session's zone.

Code
CREATE TABLE e (naive TIMESTAMP, aware TIMESTAMPTZ);
INSERT INTO e VALUES ('2026-08-25 10:00', '2026-08-25 10:00+05:30');

SET TIME ZONE 'UTC';        SELECT * FROM e;
SET TIME ZONE 'Asia/Kolkata'; SELECT * FROM e;
Output
UTC:
  naive = 2026-08-25 10:00:00     aware = 2026-08-25 04:30:00+00
Asia/Kolkata:
  naive = 2026-08-25 10:00:00     aware = 2026-08-25 10:00:00+05:30

-- naive did not move, because it never knew what instant it meant.
-- Store instants as TIMESTAMPTZ. Use TIMESTAMP only for a wall-clock
-- concept that is genuinely zoneless, like a shop's 09:00 opening time.
Advertisement

Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.

Published 2026-08-25