pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
question about timestamp with tz
3+ messages / 3 participants
[nested] [flat]

* question about timestamp with tz
@ 2009-10-22 20:41 the6campbells <the6campbells@gmail.com>
  2009-10-22 23:13 ` Re: question about timestamp with tz Tom Lane <tgl@sss.pgh.pa.us>
  2009-10-22 23:26 ` Re: question about timestamp with tz Scott Marlowe <scott.marlowe@gmail.com>
  0 siblings, 2 replies; 3+ messages in thread

From: the6campbells @ 2009-10-22 20:41 UTC (permalink / raw)
  To: pgsql-sql

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

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: question about timestamp with tz
  2009-10-22 20:41 question about timestamp with tz the6campbells <the6campbells@gmail.com>
@ 2009-10-22 23:13 ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2009-10-22 23:13 UTC (permalink / raw)
  To: the6campbells <the6campbells@gmail.com>; +Cc: pgsql-sql

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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: question about timestamp with tz
  2009-10-22 20:41 question about timestamp with tz the6campbells <the6campbells@gmail.com>
@ 2009-10-22 23:26 ` Scott Marlowe <scott.marlowe@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Scott Marlowe @ 2009-10-22 23:26 UTC (permalink / raw)
  To: the6campbells <the6campbells@gmail.com>; +Cc: pgsql-sql

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...



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2009-10-22 23:26 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2009-10-22 20:41 question about timestamp with tz the6campbells <the6campbells@gmail.com>
2009-10-22 23:13 ` Tom Lane <tgl@sss.pgh.pa.us>
2009-10-22 23:26 ` Scott Marlowe <scott.marlowe@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox