【发布时间】:2018-09-03 10:09:26
【问题描述】:
我正在尝试从 PostgreSQL 数据库中的 timestamptz 字段中选择本地时间(如澳大利亚/布里斯班),并注意到当我使用 +10 时区缩写时,PostgreSQL 似乎从UTC 值而不是添加 10 小时。
如果我使用AEST 作为缩写,则正确添加了 10 小时。
当我运行以下查询时,我希望返回的两个值是相同的。
select
('2018-01-01T00:00:00Z'::timestamp with time zone) at time zone 'AEST',
('2018-01-01T00:00:00Z'::timestamp with time zone) at time zone '+10';
但是,就我而言,我看到了以下结果:
"2018-01-01 10:00:00" | "2017-12-31 14:00:00"
如果我运行以下查询,所有行的“utc_offset”间隔为 10:00:00。
select * from pg_timezone_names
where abbrev in ('+10', 'AEST')
谁能解释这里发生了什么?
【问题讨论】:
-
我想你正在看这个的副本:stackoverflow.com/questions/8399140/…
-
为什么不直接通过
at time zone 'Australia/Brisbane'?
标签: postgresql timezone postgresql-10