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.
