From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Tim Uckun <timuckun@gmail.com>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Timestamp with vs without time zone.
Date: Tue, 21 Sep 2021 07:48:14 -0700
Message-ID: <2b5872f2-502d-369f-3dd6-1f7907883bfc@aklaver.com> (raw)
In-Reply-To: <CAGuHJrPKdrXGAFkzE4tXd3b5uKe47WCRdV3LNrYi_HBjYYa+OA@mail.gmail.com>
References: <CAGuHJrPKdrXGAFkzE4tXd3b5uKe47WCRdV3LNrYi_HBjYYa+OA@mail.gmail.com>
On 9/20/21 11:00 PM, Tim Uckun wrote:
> I am hoping to get some clarification on timestamp with time zone.
>
> My understanding is that timestamp with time zone stores data in UTC
> but displays it in your time zone. Does this also work on queries? If
> I query between noon and 2:00 PM on some date in time zone XYZ does pg
> translate the query to UTC before sending it to the server?
>
> So does the database know the timestamp is in auckland time when the
> client is connecting from a server on UTC?
My question would be why does it matter? The whole purpose of
timestamptz is that you know it is stored as UTC, from there you can
transform to whatever time zone you want.
--
Adrian Klaver
adrian.klaver@aklaver.com
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: adrian.klaver@aklaver.com, timuckun@gmail.com
Subject: Re: Timestamp with vs without time zone.
In-Reply-To: <2b5872f2-502d-369f-3dd6-1f7907883bfc@aklaver.com>
References: <CAGuHJrPKdrXGAFkzE4tXd3b5uKe47WCRdV3LNrYi_HBjYYa+OA@mail.gmail.com> <2b5872f2-502d-369f-3dd6-1f7907883bfc@aklaver.com>
* 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