| From: | chris <chrisk(at)pgsqlrocket(dot)com> | 
|---|---|
| To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> | 
| Cc: | Postgres General <pgsql-general(at)postgresql(dot)org> | 
| Subject: | Re: selecting timestamp | 
| Date: | 2018-02-28 21:15:27 | 
| Message-ID: | 030374b6-2793-4b7a-970f-929f2050b277@pgsqlrocket.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
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(at)pgsqlrocket(dot)com 
> <mailto:chrisk(at)pgsqlrocket(dot)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.
>
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | btober@computer.org | 2018-02-28 21:29:52 | Re: Enforce primary key on every table during dev? | 
| Previous Message | Tim Cross | 2018-02-28 21:07:43 | Re: Enforce primary key on every table during dev? |