Re: Daylight saving time question - Mailing list pgsql-general

From Bayless Kirtley
Subject Re: Daylight saving time question
Date
Msg-id FD200C5ACB0F4C5C86C5E67A2E5585AD@dell2400
Whole thread Raw
In response to Daylight saving time question  ("Bayless Kirtley" <bkirt@cox.net>)
Responses Re: Daylight saving time question
Re: Daylight saving time question
List pgsql-general
Thanks Tom and Scott. You got me looking in the right direction. In this
case
the client and server are on the same machine (testing/development) and psql
does return the right result. I tried all the possibilities from the java
program,
"show timezone", "select current_time" and "select current_timestamp". These
were all JDBC queries. When I used result.getString(), the values looked
right. When I used result.getTime(), they were off by one hour as if
daylight
saving were not in effect.

Is this a flaw in the JDBC driver or is that the expected behavior? In
either
case I do now have a workaround but would like to know.

Thanks again.



----- Original Message -----
From: "Tom Lane" <tgl@sss.pgh.pa.us>
To: "Bayless Kirtley" <bkirt@cox.net>
Cc: "John R Pierce" <pierce@hogranch.com>; "PostgreSQL"
<pgsql-general@postgresql.org>
Sent: Monday, May 18, 2009 12:26 PM
Subject: Re: [GENERAL] Daylight saving time question


> "Bayless Kirtley" <bkirt@cox.net> writes:
>> For some reason I can't seem to make it work. I have tried setting the
>> timezone
>> in postgresql.conf as "timezone = 'America/Chicago'" and "timezone =
>> 'CST6CDT'"
>> both of which still returned one hour behind. I also tried both of your
>> suggestions
>> as SQL statements right after establishing a database connection and
>> still
>> get the
>> same wrong time.
>
>> I have a Java application on Windows XP PRO and the way I am getting the
>> time is "Select CURRENT_TIME". Is there something I am missing or is
>> there
>> another way I should be getting the time?
>
> Are you sure the system's time is actually set correctly on the server
> machine?  Seems like confusion between standard and daylight time in
> setting the server's clock might be the underlying issue here.
>
> Another theory is that the database is perfectly fine but there's
> something wacko happening on the Java side.  Have you tried running
> "select current_time" from some other application, like psql?  (In
> that connection I note that "select current_time" only gives time of
> day not a full timestamp, so I'd not exactly be surprised if it does
> confuse Java.  "select current_timestamp" produces a much less ambiguous
> result.)
>
> regards, tom lane
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general


pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Daylight saving time question
Next
From: Zico
Date:
Subject: Re: Need help