Re: Daylight saving time question

Поиск
Список
Период
Сортировка
От Lew
Тема Re: Daylight saving time question
Дата
Msg-id gv9i5u$35v$1@news.albasani.net
обсуждение исходный текст
Ответ на Re: Daylight saving time question  ("Bayless Kirtley" <bkirt@cox.net>)
Список 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 по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: 8.3: timestamp subtraction
Следующее
От: Havasvölgyi Ottó
Дата:
Сообщение: Re: 8.3: timestamp subtraction