Re: BUG #15388: time convert error when use AT TIME ZONE '+8'
От | Tom Lane |
---|---|
Тема | Re: BUG #15388: time convert error when use AT TIME ZONE '+8' |
Дата | |
Msg-id | 20541.1537242305@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | BUG #15388: time convert error when use AT TIME ZONE '+8' (PG Bug reporting form <noreply@postgresql.org>) |
Ответы |
Re: BUG #15388: time convert error when use AT TIME ZONE '+8'
|
Список | pgsql-bugs |
=?utf-8?q?PG_Bug_reporting_form?= <noreply@postgresql.org> writes: > 1. What did you do? > SET TIME ZONE 'utc'; > SELECT TIMESTAMP '2001-02-16 20:38:40' AT TIME ZONE '+8'; > 2. What did you expect to see? > timezone > ------------------------ > 2001-02-16 12:38:40+00 You're apparently confused about the sign of time zone offsets. In a POSIX-style zone name, which is what you have there, plus means west of Greenwich; so this is the right answer: > 3. What did you see instead? > timezone > ------------------------ > 2001-02-17 04:38:40+00 See https://www.postgresql.org/docs/current/static/datatype-datetime.html#DATATYPE-TIMEZONES notably the comment that 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. If you want to use the ISO sign convention, you can do it with an interval-type zone specification: regression=# SELECT TIMESTAMP '2001-02-16 20:38:40' AT TIME ZONE '+8:00'::interval; timezone ------------------------ 2001-02-16 12:38:40+00 (1 row) regards, tom lane
В списке pgsql-bugs по дате отправления: