SELECT EXTRACT(EPOCH FROM '01-01-1970 00:00:00 UTC+01'::timestamp with time zone)
=> 3600
SELECT EXTRACT(EPOCH FROM '1970-01-01 00:00:00+01'::timestamp with time zone)
=> -3600
Postgres 8.3.14
解决方法
1970-01-01 00:00:00+01
是一个ISO 8601 timestamp with a +1 hour offset和1意味着格林威治以东.这些中的抵消
01-01-1970 00:00:00 UTC+01 1970-01-01 00:00:00 UTC+01 1970-01-01 00:00:00 XXX+01 1970-01-01 00:00:00 HAHA+01 1970-01-01 00:00:00 Pancakes+01
将被解释为POSIX style timezones,其中1表示格林威治以西:
Postgresql will accept POSIX-style time zone specifications of the form STDoffset or STDoffsetDST,where STD is a zone abbreviation,offset is a numeric offset in hours west from UTC
@H_404_44@那些甚至带来警告:
One should be wary that the POSIX-style time zone feature can lead to silently accepting bogus input,since there is no check on the reasonableness of the zone abbreviations. For example,
@H_404_44@SET TIMEZONE TO FOOBAR0
will work,leaving the system effectively using a rather peculiar abbreviation for UTC. Another issue to keep in mind is that in POSIX time zone names,positive offsets are used for locations west of Greenwich. Everywhere else,Postgresql follows the ISO-8601 convention that positive timezone offsets are east of Greenwich.注意西与东的差异.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。