Re: [HACKERS] timezone problem?

From: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
To: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] timezone problem?
Date: 2000-01-20 16:01:03
Message-ID: 3887313F.8D8DF166@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Why do I get different date/time after explicitly setting timezone?
> This is RH Linux 5.2.

Because...

> test=> select '1998-09-23 12:05:10 HST'::datetime;
> ------------------------------
> Thu Sep 24 07:05:10 1998 JST
> test=> show timezone;
> NOTICE: Time zone is unknown
> SHOW VARIABLE
> test=> set timezone to 'JST';
> SET VARIABLE
> test=> select '1998-09-23 12:05:10 HST'::datetime;
> ------------------------------
> Wed Sep 23 22:05:10 1998 JST

On my RH-5.2 box, "JST" is not in /usr/share/zoneinfo. A non-existant
TZ evaluates to be GMT, but the system reports the string you gave
it!! I don't recall ever running across this before. But the moral of
the story is: don't do that! ;)

I'm not sure how one would check to verify that the timezone you set
is actually a valid timezone. I'd hate to restrict it to the list of
timezones Postgres knows about when parsing input (since that is a
subset of the possibilities), though that is one solution...

- Thomas

[root(at)golem zoneinfo]# setenv TZ HST
[root(at)golem zoneinfo]# date
Thu Jan 20 05:55:02 HST 2000
[root(at)golem zoneinfo]# setenv TZ JST
[root(at)golem zoneinfo]# date
Thu Jan 20 15:54:37 JST 2000
[root(at)golem zoneinfo]# setenv TZ GMT
[root(at)golem zoneinfo]# date
Thu Jan 20 15:54:45 GMT 2000

--
Thomas Lockhart lockhart(at)alumni(dot)caltech(dot)edu
South Pasadena, California

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-01-20 16:02:31 Re: [HACKERS] COPY problems with psql / libpq
Previous Message Tom Lane 2000-01-20 15:55:05 Re: [HACKERS] A notice for too long names