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 1r7cVU-0060J8-Bb for pgsql-docs@arkaria.postgresql.org; Mon, 27 Nov 2023 14:22:40 +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 1r7cVS-00E0nJ-SH for pgsql-docs@arkaria.postgresql.org; Mon, 27 Nov 2023 14:22:38 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r7cVS-00E0n0-3S for pgsql-docs@lists.postgresql.org; Mon, 27 Nov 2023 14:22:38 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r7cVL-007bz8-8H for pgsql-docs@postgresql.org; Mon, 27 Nov 2023 14:22:36 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 9DA995C0198; Mon, 27 Nov 2023 09:22:30 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 27 Nov 2023 09:22:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1701094950; x= 1701181350; bh=Cd+0y6J57HP7da4qiXdDHFmi4lHWFrMVdkuwUVxAi+Q=; b=u db7krwTTyotx2sPi5lWiDBzJNHTXkz8SXu4KvQg5DauXYmmK5rkORNmCXF0VK5oM vf/9kK8EyS45P8vkwu07ims6ooq51xeRVN9bcY+ChscaDBDoTQHDvapCJ+3OZL/J BD1rLrj2uwS1k2iWFYUUdgT6sLIGF6qRscJlD48B4S2nvbtTHWL7GN5Xrl0w269d hdD5GArY1gez1aOBRPKRJxwsq76XWqk2mFTx114dc1wNTRm5/ABV0Omb3WHlhA3/ DS9TYuuS6rUQ8N26YjXG5FKcG/XfzJn0KwtoZKsdIviTZ7NAG/GPogojzZo8irmm lWmfUqOzUvZ/XkEdoXf+w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudeiuddgieegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepteejtdehuddutdethffhffekleefueetlefhffeigfei ieehgeeigfeiffejuedvnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomh dprggtthhsohhfghhorhgurdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr rghmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 27 Nov 2023 09:22:29 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1701094948; bh=8Zpjb2U8TqbrHhJ/0hq9k/DMDwCbGq939e5gCnyNkuk=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=dKH2tPn/L0wghrApam/SGTl2gq5J4DZCT/oylee3AwYwFUzzYvBM5MxAU06zrNUTk 80uOtxKugSz9O0YoSOQ9wg9ViLN7mBnyNtVyVSCXQThdCKmUrZev1ddM8FUp4EEVAY d143rtA9p+zTdSi8rDwBP9wiN60pdm1gZo+d5nJDK9SNs4Ag+a1XUoXLWMaGtPQ9T7 DUD568EVP0wUHpGoZGiZXvXwZckLx5ff0xYk7kfJd/sch0ScMi7UyDfzrdMSVdMvSN XogLzIOLCs1l8tsG/WtfeRJ04R8MxnzKI2DEJ6MqurM5C4FL1Ak5JWswrJFISfLz4d VNy6415/YBDbQ== Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 10195DB; Mon, 27 Nov 2023 15:22:28 +0100 (CET) Date: Mon, 27 Nov 2023 15:22:28 +0100 From: Alvaro Herrera To: Erik Wienhold Cc: Bruce Momjian , Laurenz Albe , juha.mustonen@iki.fi, pgsql-docs@postgresql.org Subject: Re: [DOCS] Add example about date ISO format Message-ID: <202311271422.j6abzoo2x44p@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-Nov-27, Erik Wienhold wrote: > Two issues that I fixed in the attached patch: > > * it's called "extended format" not "T format" (the "T" is mandatory > anyway) +1 > * the time zone was missing from the result output This is wrong. Actually, there's no timezone in value, because the use of the AT TIME ZONE operator makes the type be TIMESTAMP WITHOUT TIME ZONE. You would notice this if you were to change the incorrect literal Z in your format string with "TZ" (which expands to empty), with "OF" (which expands to "+00"), or with "TZH:TZM" (which expands to the full timezone shift): # select to_char(current_timestamp at time zone 'America/Santiago', 'YYYY-MM-DD"T"HH24:MI:SSTZ'); to_char ───────────────────── 2023-11-27T11:14:55 =# select to_char(current_timestamp at time zone 'America/Santiago', 'YYYY-MM-DD"T"HH24:MI:SSOF'); to_char ──────────────────────── 2023-11-27T11:14:55+00 =# select to_char(current_timestamp at time zone 'America/Santiago', 'YYYY-MM-DD"T"HH24:MI:SSTZH:TZM'); to_char ─────────────────────────── 2023-11-27T11:14:55+00:00 The final Z in your example just prints a literal Z. (America/Santiago is UTC-3 currently, not 0, which you would see like this: =# set timezone to 'America/Santiago'; =# select to_char(current_timestamp, 'YYYY-MM-DD"T"HH24:MI:SSOF'); to_char ──────────────────────── 2023-11-27T11:21:37-03 ) -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ "The Gord often wonders why people threaten never to come back after they've been told never to return" (www.actsofgord.com)