question about timestamp with tz

View: New views
3 Messages — Rating Filter:   Alert me  

question about timestamp with tz

by the6campbells :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Question.. is there a way that I can get Postgres to return the tz as supplied on the insert statement 

insert into TTSTZ(RNUM, CTSTZ) values ( 0, null);
insert into TTSTZ(RNUM, CTSTZ) values ( 1, timestamp with time zone '2000-12-31 12:00:00.0-05:00');
insert into TTSTZ(RNUM, CTSTZ) values ( 2, timestamp with time zone '2000-12-31 12:00:00+00:00');
insert into TTSTZ(RNUM, CTSTZ) values ( 3, timestamp with time zone '2000-12-31 12:00:00.0+05:00');

select rnum, CTSTZ

0;""
1;"2000-12-31 12:00:00-05"
2;"2000-12-31 07:00:00-05"
3;"2000-12-31 02:00:00-05"

select rnum, extract (hour from ctstz), extract (timezone_hour from ctstz) from ttstz

0;;
1;12;-5
2;7;-5
3;2;-5




Re: question about timestamp with tz

by Tom Lane-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

the6campbells <the6campbells@...> writes:
> Question.. is there a way that I can get Postgres to return the tz as
> supplied on the insert statement

No.

                        regards, tom lane

--
Sent via pgsql-sql mailing list (pgsql-sql@...)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

Re: question about timestamp with tz

by Scott Marlowe-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Oct 22, 2009 at 2:41 PM, the6campbells <the6campbells@...> wrote:
> Question.. is there a way that I can get Postgres to return the tz as
> supplied on the insert statement

PostgreSQL converts the timezone to GMT and stores it with no offset,
then adds an offset based on the TZ of the client requesting it back
later.

If you want to store the offset you'll have to do it yourself.  Note
that offset does not necessarily = timezone...

--
Sent via pgsql-sql mailing list (pgsql-sql@...)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql