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: 18974.1074553203@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

Browse pgsql-novice by date

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