Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u9bLr-003sfT-OW for pgsql-novice@arkaria.postgresql.org; Tue, 29 Apr 2025 03:09:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1u9bLp-004lnA-Mv for pgsql-novice@arkaria.postgresql.org; Tue, 29 Apr 2025 03:09:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u9bLp-004ln0-EV for pgsql-novice@lists.postgresql.org; Tue, 29 Apr 2025 03:09:42 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u9bLo-00072w-1L for pgsql-novice@lists.postgresql.org; Tue, 29 Apr 2025 03:09:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=momjian.us; s=2025010100; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description; bh=DOGA0A1k1ePUstkEtzMBGHbAN3k0kXjO++kveo55JdQ=; b=P3YDB foVMNdHmPW/weBqgRPqEc/cdkAUQN3F0MudfAphQGA8KtsALOir/8opftXcBFIHuXIDDrqzk3Efmy MVwxUZMhhzaEKJI4zU/ShWn0p9z6+3w0DZ7H+Qk+IAmhaBuuFZ+ka7eq/Wp6DbAEH8ZU+ZjaZivOu TWW69pf8gmyhEAdztNyDVbwr721jwo+rm1EMvDZEYgJDqUYRY/5qkOQwtaWklFuZTjSqRztq5Ip2D e8iLILHWH2hZHxS0NW4wFuPUPQ9FqD036u77syISLrY4O2r5eBBwrjpY5eHdsmJ0W4h4g/03kvz7x VYlgSNrVJa0ALr4yDDS7di5hfdCSg==; Received: from bruce by momjian.us with local (Exim 4.96) (envelope-from ) id 1u9bLm-00Bwnu-0f; Mon, 28 Apr 2025 23:09:38 -0400 Date: Mon, 28 Apr 2025 23:09:38 -0400 From: Bruce Momjian To: H Witt Cc: "pgsql-novice@lists.postgresql.org" Subject: Re: why at time zone tz_offset not equal tz_name? tz_name has same offset in pg_timezone_names Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Apr 29, 2025 at 02:40:45AM +0000, H Witt wrote: > 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' > > display > |2025-02-02 23:04:05.000|2025-02-03 15:04:05.000| The sign is wrong in the first column: 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' ; timezone | timezone ---------------------+--------------------- 2025-02-04 04:04:05 | 2025-02-04 04:04:05 See: https://www.postgresql.org/docs/current/datetime-posix-timezone-specs.html The offset fields specify the hours, and optionally minutes and seconds, difference from UTC. They have the format hh[:mm[:ss]] optionally with a leading sign (+ or -). The positive sign is used for zones west of Greenwich. (Note that this is the opposite of the ISO-8601 sign convention used elsewhere in PostgreSQL.) hh can have one or two digits; mm and ss (if used) must have two. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Do not let urgent matters crowd out time for investment in the future.