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

Поиск
Список
Период
Сортировка
От David Gauthier
Тема Re: timestamp (military) at time zone without the suffix
Дата
Msg-id CAMBRECBdRyvbFZQFEMx0QqgWsduJV+vG3xJ+6FZTB2CexscYiQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: timestamp (military) at time zone without the suffix  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: timestamp (military) at time zone without the suffix
Re: timestamp (military) at time zone without the suffix
Список pgsql-general
Thanks Everyone, they all work, but TL's seems to be the simplest...
select current_timestamp(0) at time zone 'utc'

I'm kinda stuck with the timestamp data type (vs timestamptz).  Wondering if I can stick with that.

One last question...
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?

Right now the code is just inserting and updating records using "localtimestamp(0)".


 

On Wed, Jul 11, 2018 at 4:11 PM, David G. Johnston <david.g.johnston@gmail.com> wrote:
On Wednesday, July 11, 2018, David Gauthier <davegauthierpg@gmail.com> wrote:
OK, the "to_char" gets rid of the timezone extension.  But the times still don't make sense. 

When I go to store this in a DB, I want to store the UTC time.  How d I do that ? 

Use the data type that represents exactly that, timestamptz.  Using the timestamp data type is generally not what you want even if you can get the manipulation logic figured out.

David J. 

В списке pgsql-general по дате отправления:

Предыдущее
От: Christopher Browne
Дата:
Сообщение: Re: Open Source tool to deploy/promote PostgreSQL DDL
Следующее
От: Ron
Дата:
Сообщение: Re: Open Source tool to deploy/promote PostgreSQL DDL