Re: timestamptz insert

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: timestamptz insert
Дата
Msg-id 18974.1074553203@sss.pgh.pa.us
обсуждение исходный текст
Ответ на timestamptz insert  ("Seader, Cameron" <CSeader@idahopower.com>)
Список pgsql-novice
"Seader, Cameron" <CSeader@idahopower.com> writes:
> When i insert data into the timestamptz field it is  automatically adding on
> the time zone of MST which is not correct. The data that is being inserted
> is not MST it is GMT. how do i make it insert as GMT.

You can either SET TIMEZONE TO 'GMT' or explicitly specify -00 in the
input data.  If you want it to come back out in GMT then you will
definitely need to set the timezone value.

Realize that what is stored in the database is GMT in any case.  If you
enter a timestamp that doesn't mention any particular zone, then it is
assumed to be in the zone specified by the timezone variable.  In either
case, a non-GMT timestamp is then adjusted to GMT for storage.  When the
value is displayed, it is adjusted back to the zone currently selected
by the timezone variable (which might or might not be the same as the
zone it was originally entered in).  A little experimentation with
changing timezone and seeing how entry and output are affected should
make this clearer.

            regards, tom lane

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

Предыдущее
От: "Seader, Cameron"
Дата:
Сообщение: timestamptz insert
Следующее
От: Noel
Дата:
Сообщение: long deletes :( Pls help