Обсуждение: question about timestamp with tz

Поиск
Список
Период
Сортировка

question about timestamp with tz

От
the6campbells
Дата:
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

От
Tom Lane
Дата:
the6campbells <the6campbells@gmail.com> 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


Re: question about timestamp with tz

От
Scott Marlowe
Дата:
On Thu, Oct 22, 2009 at 2:41 PM, the6campbells <the6campbells@gmail.com> 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...