小编Isl*_*gre的帖子

PostgreSQL 如何知道我当前是否在时区“CET”中使用 DST?

我在我的中找到了以下行postgresql.conf:

timezone = 'CET'
Run Code Online (Sandbox Code Playgroud)

我也通过查询设置得到了这个:

postgres=# show timezone;
 TimeZone
----------
 CET
Run Code Online (Sandbox Code Playgroud)

无论如何,我们目前仍然有 DST 活动,下面的示例显示服务器知道这一点(+02 是 CEST):

postgres=# select now();
              now
-------------------------------
 2019-10-09 02:03:33.48477+02
Run Code Online (Sandbox Code Playgroud)

但也有 PostgreSQL 已知的时区,缩写为 DST CET,并且没有 DST。特别是,所有具有此缩写的时区都有偏移+01:

postgres=# select * from pg_timezone_names() where abbrev = 'CET';
      name      | abbrev | utc_offset | is_dst
----------------+--------+------------+--------
 Africa/Algiers | CET    | 01:00:00   | f
 Africa/Tunis   | CET    | 01:00:00   | f

postgres=# select * from pg_timezone_abbrevs where abbrev = 'CET';
 abbrev | utc_offset | is_dst
--------+------------+--------
 CET    | …
Run Code Online (Sandbox Code Playgroud)

postgresql timezone timestamp-with-timezone postgresql-9.6

5
推荐指数
0
解决办法
1987
查看次数