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!