From: chris <chrisk@pgsqlrocket.com>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Postgres General <pgsql-general@postgresql.org>
Subject: Re: selecting timestamp
Date: Wed, 28 Feb 2018 14:15:27 -0700
Message-ID: <030374b6-2793-4b7a-970f-929f2050b277@pgsqlrocket.com> (raw)
In-Reply-To: <CAKFQuwZ3DYbuFwP+HAmEyPcf29adBFHJ5ME4jSOWzeuhnwN5cA@mail.gmail.com>
References: <0a80c0d7-3c90-3051-3835-8d973db8bdc4@pgsqlrocket.com>
<32ecec3a-654d-25e5-75ea-ccd7e2331429@pgsqlrocket.com>
<CAKFQuwZ3DYbuFwP+HAmEyPcf29adBFHJ5ME4jSOWzeuhnwN5cA@mail.gmail.com>
Thank you everyone for the help.
Sorry there wasn't much detail given originally.
CURRENT_TIMESTAMP at time zone 'UTC' as ct4
Seems to be working well.
Thanks,
Chris
On 02/27/2018 01:26 PM, David G. Johnston wrote:
> On Tue, Feb 27, 2018 at 1:16 PM, chris <chrisk@pgsqlrocket.com
> <mailto:chrisk@pgsqlrocket.com>>wrote:
>
>
> What is the best way of selecting current timestamp in UTC?
>
>
> You
> haven't
> define
> d
> criteria upon which to judge - and the list below is not exhaustive
> (but sufficiently so)
>
>
>
> SELECT
> CURRENT_TIMESTAMP as ct1
>
>
> standard conforming, assumes server configured for UTC
>
>
> ,timezone('UTC',CURRENT_TIMESTAMP) as ct2
> ,timezone('utc',now()) as ct3
>
>
> non-standard, personally non-obvious (the function looks like an
> implementation detail that should be avoided)
>
> ,CURRENT_TIMESTAMP at time zone 'UTC' as ct4
>
>
> This -
>
> standard conforming and doesn't require assumptions about the calling
> environment
>
> ,NOW() at time zone 'utc' as ct5
>
>
> non-standard but frequently used; no semantic different compared to
> the previous entry
>
> David J.
>
>
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: chrisk@pgsqlrocket.com, david.g.johnston@gmail.com
Subject: Re: selecting timestamp
In-Reply-To: <030374b6-2793-4b7a-970f-929f2050b277@pgsqlrocket.com>
References: <0a80c0d7-3c90-3051-3835-8d973db8bdc4@pgsqlrocket.com> <32ecec3a-654d-25e5-75ea-ccd7e2331429@pgsqlrocket.com> <CAKFQuwZ3DYbuFwP+HAmEyPcf29adBFHJ5ME4jSOWzeuhnwN5cA@mail.gmail.com> <030374b6-2793-4b7a-970f-929f2050b277@pgsqlrocket.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