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 1r5evo-00EPNK-Lz for pgsql-docs@arkaria.postgresql.org; Wed, 22 Nov 2023 04:33: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 1r5evn-004f2Z-AZ for pgsql-docs@arkaria.postgresql.org; Wed, 22 Nov 2023 04:33:43 +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 1r5evn-004f2P-2m for pgsql-docs@lists.postgresql.org; Wed, 22 Nov 2023 04:33:43 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r5evk-006kZS-KB for pgsql-docs@postgresql.org; Wed, 22 Nov 2023 04:33:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=momjian.us; s=2023062407; 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=s4VtdliG4t60DOmdwkE5jXztZZQOgOSY3ywNH4Pg5lY=; b=4V6Qx cXrgZKqvTGADgNzb5zEYO7XaWEm8xApj0h9pHzl9VqYQJs7sIX7APlAMomgeKTQkuw/gfaPyZlEt8 PAKnqd3ozXkimtlcTd1YnIiylWSpL2gMXOIBog1O4yQqhDEkUFh5kMtLoQWYOOmYEqG5YqFiOrJrZ oxrxRMwCHisJPB58wNcQqIumPXS/AyZz3YjX08QgmxffBoEKtuSIxyHEnSXCyfz+UlzyarM3PGjwJ xUAI+H0cZMTrJmy+yoGL5U0yYsUTIogfUMhO2b/0ettzBVBp6QtJJrHyR5Y91RXtDNuno+k84Zmo9 na2SYXKS6V2Pedh63AuUaMUpRC+TQ==; Received: from bruce by momjian.us with local (Exim 4.96) (envelope-from ) id 1r5evj-008HkV-0y; Tue, 21 Nov 2023 23:33:39 -0500 Date: Tue, 21 Nov 2023 23:33:39 -0500 From: Bruce Momjian To: juha.mustonen@iki.fi Cc: pgsql-docs@postgresql.org Subject: Re: [DOCS] Add example about date ISO format Message-ID: References: <20170217160154.6101.52806@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="IRq7uP0QVUYYPTjo" Content-Disposition: inline In-Reply-To: <20170217160154.6101.52806@wrigleys.postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --IRq7uP0QVUYYPTjo Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Feb 17, 2017 at 04:01:54PM +0000, juha.mustonen@iki.fi wrote: > The following documentation comment has been logged on the website: > > Page: https://www.postgresql.org/docs/9.6/static/functions-formatting.html > Description: > > The documentation should include an example how to format datetime entry > into most commonly known ISO format. This is a bit tricky as literal > character needs to included with quotes: > > to_char(NOW(), 'YYYY-MM-DD"T"HH24:MI:SSZ') I know this is a six-year-old idea, but it is still a good one. I have developed the attached patch I would like to apply to master. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Only you can decide what is important to you. --IRq7uP0QVUYYPTjo Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="iso.diff" diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 93f068edcf..297cafb341 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -8489,6 +8489,14 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}'); + + + to_char(current_timestamp AT TIME ZONE 'UTC', + 'YYYY-MM-DD"T"HH24:MI:SSZ') outputs the current UTC + date/time in ISO 8601 date/time format. + + + --IRq7uP0QVUYYPTjo--