PostgreSQL是否正确了解夏令时?

时间:2018-11-30 06:33:31

标签: postgresql postgresql-10

比较时间戳记的计算时间会有所不同:

hj=# set time zone 'Europe/Berlin';
SET
hj=# select '1991-11-30 07:25:38.235095+01', '1991-11-30 07:25:38.235095+01'::timestamp with time zone - '2 months'::interval;
           ?column?            |           ?column?            
-------------------------------+-------------------------------
 1991-11-30 07:25:38.235095+01 | 1991-09-30 07:25:38.235095+01

hj=# select '2010-11-30 07:25:38.235095+01', '2010-11-30 07:25:38.235095+01'::timestamp with time zone - '2 months'::interval;
           ?column?            |           ?column?            
-------------------------------+-------------------------------
 2010-11-30 07:25:38.235095+01 | 2010-09-30 07:25:38.235095+02

实际上,夏令时是在1980年引入的,至今尚未更改。因此,无论在2010年还是1991年这两种情况下,结果末尾都应显示“ +02”,因为在9月,夏令时有效。

0 个答案:

没有答案
相关问题