public inbox for [email protected]  
help / color / mirror / Atom feed
From: David G. Johnston <[email protected]>
To: [email protected]
To: [email protected]
Subject: Re: Suspected documentation error
Date: Tue, 5 May 2026 16:27:42 -0700
Message-ID: <CAKFQuwYWhSxoCPf9RTVVgs96oU78rdh3Aj05s2PCppb1GscA8g@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

On Tue, May 5, 2026 at 3:02 PM PG Doc comments form <[email protected]>
wrote:

> As such, whilst looking through this page
> (https://www.postgresql.org/docs/current/functions-formatting.html) as
> shown
> in the Udemy course I'm following, I noticed that the notes "OF" state
> "time-zone offset from UTC (HH or HH:MM)", which I believe should be
> "time-zone offset from UTC (HH or HH:MI)".
>
>
Technically interpreting either of those according to the format specifiers
co-located in that table is wrong.  All HH and MM stand for here are hours
and minutes, trying to communicate fixed two-digits.

psql -c "SET LOCAL timezone = 'Pacific/Apia'; SELECT to_char(now(),
'YYYY-MM-DD HH24:MI:SS OF') AS plus13_apia;"

       plus13_apia
-------------------------
 2026-05-06 12:11:49 +13
(1 row)

HH is defined on the range 0-12 but here we see we get +13 (and it's easy
to also produce negative offsets).

That said, the way I'd fix this is:

TZH - time-zone hours offset from UTC , signed, two-digits, e.g., -04 or +05
TZM - time-zone minutes offset from UTC, unsigned two-digit (to append, not
add), e.g., 00 or 30
OF - TZH[:TZM] time-zone offset, but minutes are suppressed when zero.
e.g., -04 or +05:30

David J.


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: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Suspected documentation error
  In-Reply-To: <CAKFQuwYWhSxoCPf9RTVVgs96oU78rdh3Aj05s2PCppb1GscA8g@mail.gmail.com>

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

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