pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: juha.mustonen@iki.fi
Cc: pgsql-docs@postgresql.org
Subject: Re: [DOCS] Add example about date ISO format
Date: Tue, 21 Nov 2023 23:33:39 -0500
Message-ID: <ZV2Eo8P4q_2_F1Qe@momjian.us> (raw)
In-Reply-To: <20170217160154.6101.52806@wrigleys.postgresql.org>
References: <20170217160154.6101.52806@wrigleys.postgresql.org>

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(), &#39;YYYY-MM-DD&quot;T&quot;HH24:MI:SSZ&#39;)

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  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Only you can decide what is important to you.

Attachments:

  [text/x-diff] iso.diff (579B, ../ZV2Eo8P4q_2_F1Qe@momjian.us/2-iso.diff)
  download | inline 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}');
       </para>
      </listitem>
 
+     <listitem>
+      <para>
+        <literal>to_char(current_timestamp AT TIME ZONE 'UTC',
+        'YYYY-MM-DD"T"HH24:MI:SSZ')</literal> outputs the current UTC
+        date/time in <acronym>ISO</acronym> 8601 date/time format.
+      </para>
+     </listitem>
+
     </itemizedlist>
    </para>
 

view thread (17+ messages)  latest in thread

Message-ID: <ZV2Eo8P4q_2_F1Qe@momjian.us>
Permalink:  ../ZV2Eo8P4q_2_F1Qe@momjian.us/
Also on:    postgresql.org/message-id/ZV2Eo8P4q_2_F1Qe@momjian.us

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: bruce@momjian.us, juha.mustonen@iki.fi
  Subject: Re: [DOCS] Add example about date ISO format
  In-Reply-To: <ZV2Eo8P4q_2_F1Qe@momjian.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox