Re: why at time zone tz_offset not equal tz_name? tz_name has same offset in pg_timezone_names

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: H Witt <i5d(at)live(dot)com>
Cc: "pgsql-novice(at)lists(dot)postgresql(dot)org" <pgsql-novice(at)lists(dot)postgresql(dot)org>
Subject: Re: why at time zone tz_offset not equal tz_name? tz_name has same offset in pg_timezone_names
Date: 2025-04-29 03:07:35
Message-ID: 945499.1745896055@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-novice

H Witt <i5d(at)live(dot)com> writes:
> select
> '2025-02-03 15:04:05'::timestamptz at time zone '+08:00',
> '2025-02-03 15:04:05'::timestamptz at time zone 'Asia/Shanghai'

They're different because '+08:00' is read as a POSIX time zone
specification, which has the opposite sign convention to what
you are thinking. See

https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-TIMEZONES

and especially

https://www.postgresql.org/docs/current/datetime-posix-timezone-specs.html

and remember the adage "The great thing about standards is there are
so many to choose from". Sadly, with only two relevant standards
humanity has still managed to cover the design space of which
direction from Greenwich gets the positive sign.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message David G. Johnston 2025-04-29 03:07:54 Re: why at time zone tz_offset not equal tz_name? tz_name has same offset in pg_timezone_names
Previous Message H Witt 2025-04-29 02:40:45 why at time zone tz_offset not equal tz_name? tz_name has same offset in pg_timezone_names