Menu

PostgreSQL timestamp vs timestamptz (With Time Zone)

timestamptz stores a moment in time and shows it in the session's time zone; timestamp stores a wall-clock time with no zone. Neither stores the zone you wrote. Use timestamptz for almost everything.

This page includes runnable editors. Edit, run, and see output instantly.

PostgreSQL has two timestamp types. timestamptz (timestamp with time zone) stores an exact moment: converted to UTC on input, shown in the session's time zone on output. timestamp (timestamp without time zone) stores a date and a wall-clock time with no zone. Neither stores the zone you wrote. For anything that happened at a point in time, use timestamptz.

The same input gives 2026-03-01 12:00:00 and 2026-03-01 21:00:00+09. The timestamptz value is the same instant as before, now displayed in Tokyo time. The timestamp value has no zone to convert from, so it does not move.

What happens to a time zone in the input

When the input carries an offset, timestamptz uses it to find the instant. timestamp drops it silently:

plain is 2026-03-01 12:00:00, with the +02 thrown away. with_zone is 2026-03-01 10:00:00+00, the same moment in UTC. This is how times end up hours off: an application sends an ISO string with an offset into a timestamp column, and the offset disappears.

When to use each

UseType
Created, updated, paid, logged intimestamptz
A scheduled local time that follows the local clock ("9:00 every day in the user's zone")timestamp plus a zone name column
A calendar day with no timedate
A length of timeinterval

Both types take 8 bytes and store microseconds. Set the session zone with SET TIME ZONE 'Europe/Paris'. Use full zone names, not abbreviations like EST: an abbreviation is a fixed offset that ignores daylight saving.

Convert between zones with AT TIME ZONE

AT TIME ZONE works in both directions. On a timestamptz it returns the wall-clock time in that zone, as a timestamp. On a timestamp it reads the value as local time in that zone and returns the timestamptz instant.

Noon UTC is 08:00 in New York in July, and 9:00 in Paris is 07:00 UTC. Use the first form to show a time in the user's zone, and the second to turn a local time the user typed into an instant.

Daylight saving and interval arithmetic

Adding interval '1 day' to a timestamptz keeps the same local clock time across a daylight saving change. Adding '24 hours' adds exact hours. In the United States the clocks move forward on March 8, 2026:

The first gives 2026-03-08 12:00:00-04, the second 2026-03-08 13:00:00-04. The result depends on the session's time zone, so set it explicitly in code that does date arithmetic.

Current time

now() and current_timestamp return the start time of the current transaction as timestamptz, the same value for every row a statement touches. clock_timestamp() returns the real time at each call. current_date returns a date, and localtimestamp a timestamp. A typical column is created_at timestamptz NOT NULL DEFAULT now().

Convert a timestamp column to timestamptz

If an existing timestamp column holds UTC times, convert it with USING ... AT TIME ZONE 'UTC', so the values are read as UTC rather than in the session's zone:

The value is now 2026-01-15 09:30:00+01, shown in Berlin time. The change rewrites the table, so run it at a quiet moment on a large table (ALTER TABLE covers type changes). Functions such as date_trunc, extract and age are on the date functions page, and the date/time types chapter has the full input formats.

Frequently Asked Questions

Does timestamptz store the time zone in PostgreSQL?

No. It converts the input to UTC and stores only that instant. The zone you wrote is lost; output is shown in the session's TimeZone setting. Store the zone name in a separate text column if you need it later.

What is the difference between now() and clock_timestamp()?

now() (same as current_timestamp) returns the start time of the current transaction, so it stays the same for every row and statement in it. clock_timestamp() returns the actual time at the moment it is called and changes even within one statement.

How do I get the current date in PostgreSQL?

current_date returns today's date in the session's time zone. now()::date gives the same, and localtimestamp returns the current date and time as a timestamp without zone.

How much space does a timestamp take in PostgreSQL?

8 bytes for both timestamp and timestamptz, with microsecond resolution. date takes 4 bytes.

Coddy programming languages illustration

Learn to code with Coddy

Get started