Home > Database > Mysql Tutorial > Does PostgreSQL's 'Timestamp with Time Zone' Actually Store Time Zone Information?

Does PostgreSQL's 'Timestamp with Time Zone' Actually Store Time Zone Information?

Linda Hamilton
Release: 2025-01-06 10:47:41
Original
494 people have browsed it

Does PostgreSQL's

Time Zone Storage in "Timestamp with Time Zone" Data Type

Contrary to its name, the "timestamp with time zone" data type in PostgreSQL does not actually store time zone information. The notion of a time zone is merely a display consideration, which is handled by adjusting the timestamp value based on the current time zone settings of the session.

Upon storing a timestamp, only the point in time is captured as a UTC timestamp without any zone information. This straightforward approach necessitates only 64 bits of storage.

In other words, the "timestamp with time zone" data type functions as an offset to calculate a UTC timestamp, which is the actual stored value. Conversely, when rendering a timestamp to the client, the value is displayed in accordance with the current time zone configuration.

The above is the detailed content of Does PostgreSQL's 'Timestamp with Time Zone' Actually Store Time Zone Information?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template