Re: Daylight saving time question

From: "Bayless Kirtley" <bkirt(at)cox(dot)net>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "John R Pierce" <pierce(at)hogranch(dot)com>, "PostgreSQL" <pgsql-general(at)postgresql(dot)org>, <scottmarlowe(at)gmail(dot)com>
Subject: Re: Daylight saving time question
Date: 2009-05-18 18:54:23
Message-ID: FD200C5ACB0F4C5C86C5E67A2E5585AD@dell2400
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)sss(dot)pgh(dot)pa(dot)us>
To: "Bayless Kirtley" <bkirt(at)cox(dot)net>
Cc: "John R Pierce" <pierce(at)hogranch(dot)com>; "PostgreSQL"
<pgsql-general(at)postgresql(dot)org>
Sent: Monday, May 18, 2009 12:26 PM
Subject: Re: [GENERAL] Daylight saving time question

> "Bayless Kirtley" <bkirt(at)cox(dot)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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Zico 2009-05-18 19:03:03 Re: Need help
Previous Message aravind chandu 2009-05-18 18:54:11 Data in a table to a csv file