简体   繁体   中英

Postgresql stores timezone information in TIMESTAMP WITH TIMEZONE?

I'm trying to understand how PostgreSQL handles TIMESTAMP WITH TIMEZONE type, and I 'm running into the discrepancy between theory and practice.

According to the documentation and other stack overflow posts,

For timestamp with time zone, the internally stored value is always in UTC ... When a timestamp with time zone value is output, it is always converted from UTC to the current timezone zone.

I believe this means that all timestamps in any given SELECT statement will be in the same/current timezone. However, this is what I see: 在此处输入图片说明

interview_timestamp is TIMESTAMP WITH TIMEZONE. This blows my mind.

It is strange that you sometimes see a time zone offset and sometimes not, I would blame that on the GUI you are using. Try with psql and see how the data look there.

The offset “-05:44:38” is perfectly normal, since time zones were introduced in the late 19th century and local solar time is used before that.

Just for the record, this was really a client thing and it because an offset from UTC depends on the time of year (EDT: -4, EST: -5). Offset "-05:44:38" is correct too, this is offset in TZ database for EDT/EST for years prior to 1883.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM