Skip site navigation (1) Skip section navigation (2)

Re: timestamptz insert

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Seader, Cameron" <CSeader(at)idahopower(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: timestamptz insert
Date: 2004-01-19 23:00:03
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
"Seader, Cameron" <CSeader(at)idahopower(dot)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

In response to

pgsql-novice by date

Next:From: NoelDate: 2004-01-20 01:24:47
Subject: long deletes :( Pls help
Previous:From: Seader, CameronDate: 2004-01-19 22:35:15
Subject: timestamptz insert

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group