Inconsistency between timezones

Поиск
Список
Период
Сортировка
От Manoj Ganesan
Тема Inconsistency between timezones
Дата
Msg-id 4b7f2c670909151318r58681e8eo75ecb32259b4937c@mail.gmail.com
обсуждение исходный текст
Ответы Re: Inconsistency between timezones  (Oliver Jowett <oliver@opencloud.com>)
Список pgsql-jdbc
Hi,

I am confused about how the driver interprets (if at all it does) timezones to and from the database. When I run the following queries directly on the database, these are the results I receive:

query: select clock_timestamp() + interval '15 hours'
result: "2009-09-16 06:06:33.801-05"

query: select date_trunc('day', clock_timestamp() + interval '15 hours')   
result: "2009-09-16 00:00:00-05"

The above are the values I would expect as well. However, when I run the same two queries (immediately after) from Java (via the JDBC driver), these are the results:

query: select clock_timestamp() + interval '15 hours'
result: "2009-09-16 06:08:44.751"

query: select date_trunc('day', clock_timestamp() + interval '15 hours')   
result: "2009-09-15 19:00:00.0"

As you can see, the first query yields the *expected* results. However, the second result seems to have seen some timezone conversion from GMT to Central Time somewhere. I would assume that clock_timestamp() used inside a function, or outside a function should show similar results. Replacing clock_timestamp() with current_timestamp gives the same results. Am I missing something here?

JDBC driver version: 8.1.404
Server version: 8.3

Thanks a bunch,
Manoj

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Oliver Jowett
Дата:
Сообщение: Re: TimeZone related issues in org.postgresql.jdbc2.TimestampUtils
Следующее
От: Oliver Jowett
Дата:
Сообщение: Re: Inconsistency between timezones