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

From Lew
Subject Re: Daylight saving time question
Date
Msg-id gv9i5u$35v$1@news.albasani.net
Whole thread Raw
In response to Re: Daylight saving time question  ("Bayless Kirtley" <bkirt@cox.net>)
List pgsql-general
Bayless Kirtley wrote:
> 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.

If 'result' is a Java 'java.util.Date' type (or one of its java.sql subtypes),
then it only holds milliseconds since epoch as if in GMT; 'Date' holds no
timezone information as such.  In that situation, 'result.getTime()' returns a
'long' value.

How exactly are you displaying 'result.getTime()'?  How exactly are you
determining that its value is "off" by one hour?  Can you show us Java code?

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

It is not a flaw in the JDBC driver.

--
Lew

pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: 8.3: timestamp subtraction
Next
From: Havasvölgyi Ottó
Date:
Subject: Re: 8.3: timestamp subtraction