Re: Calendar vs. Timestamp

From: "Wei Wei" <wei725(at)lycos(dot)com>
To: "Kris Jurka" <books(at)ejurka(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Calendar vs. Timestamp
Date: 2006-04-11 23:53:55
Message-ID: 20060411235355.4392FE5BC7@ws7-2.us4.outblaze.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


> > I would like to clarify one observation. The timestamp seems only
> > take the date section data of a calendar object regardless the
> > value of the time zone. If so, a calendar object with a specified
> > time zone would not make any difference in comparsion to a
> > calendar object with the default time zone. Or, the default time
> > zone is always used in PG.
> >
>
> I think the confusion arises from the fact that the server always
> stores timestamps in utc and always returns them based upon the
> current setting of the TimeZone configuration parameter.
>
> CREATE TABLE tstest(a timestamptz);
> INSERT INTO tstest VALUES ('2006-04-11 16:15:28-07');
> INSERT INTO tstest VALUES ('2006-04-11 16:15:28-08');
> SET TimeZone = 'America/Los_Angeles';
> INSERT INTO tstest VALUES ('2006-04-11 16:15:28');
> SELECT * FROM tstest;

2006-04-11 16:15:28-07
2006-04-11 17:15:28-07
2006-04-11 16:15:28-07

> SET TimeZone = 'America/New_York';
> INSERT INTO tstest VALUES ('2006-04-11 16:15:28');
> SELECT * FROM tstest;
>

2006-04-11 19:15:28-04
2006-04-11 20:15:28-04
2006-04-11 19:15:28-04
2006-04-11 16:15:28-04

>

Thanks for the test code to clarify the time zone matter. I need to change my approach to show the date & time with the users' time zones.

--
_______________________________________________

Search for businesses by name, location, or phone number. -Lycos Yellow Pages

http://r.lycos.com/r/yp_emailfooter/http://yellowpages.lycos.com/default.asp?SRC=lycos10

Browse pgsql-jdbc by date

  From Date Subject
Next Message Yi Lin 2006-04-12 01:07:13 Re: FastPath blocked when ERROR is thrown
Previous Message Kris Jurka 2006-04-11 23:19:49 Re: Calendar vs. Timestamp