Re: timestamp (military) at time zone without the suffix

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: David Gauthier <davegauthierpg(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: timestamp (military) at time zone without the suffix
Date: 2018-07-11 20:59:31
Message-ID: CAKFQuwYU2GgTnaOOQHxGSBfEZR1XxzN4PYKjNeovWuJTFYk2cA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wednesday, July 11, 2018, David Gauthier <davegauthierpg(at)gmail(dot)com>
wrote:
>
> I want to store the current UTC date/time in the DB. Does PG
> unconditionally store something like UTC, then let the queries figure out
> how they want to look at it (with "at time zone" and "to_char()" etc...) ?
> Or do I have to intentionally store the UTC value somehow?
>

If you use timestamptz the server interprets the stored value as being
UTC. If you use timestamp the server interprets the stored value using
whatever the current Time Zone happens to be when the value is read (or it
uses the at time zone value if specified).

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Igal @ Lucee.org 2018-07-11 21:08:41 Re: How to tell which event was fired in Trigger function
Previous Message Ron 2018-07-11 20:42:43 Re: Open Source tool to deploy/promote PostgreSQL DDL