Re: Two millisecond timestamp offset

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: Two millisecond timestamp offset
Дата
Msg-id 43219B60.2050706@opencloud.com
обсуждение исходный текст
Ответ на Two millisecond timestamp offset  (Adrian Cox <adrian@humboldt.co.uk>)
Ответы Re: Two millisecond timestamp offset
Список pgsql-jdbc
Adrian Cox wrote:

> The output from Java code is:
> Result 1 :- 2005-05-12 17:14:21.000
> Result 2 :- 2004-11-10 17:32:19.002
>
> The database sees:
> testcode=> select * from test;
>  index |          datetime
> -------+----------------------------
>      1 | 2005-05-12 17:14:20.998+00
>      2 | 2004-11-10 17:32:19+00
> (2 rows)

This works correctly on my system, so there is something else going on here.

What is the JVM's default timezone? If you format the Date objects using
that timezone, what do you get?

The JDBC driver will use the JVM's default timezone to format dates
unless you explicitly pass a Calendar to setTimestamp() etc, so if that
timezone is mysteriously 2ms out then it'd explain the strange behaviour
you see.

-O

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

Предыдущее
От: Adrian Cox
Дата:
Сообщение: Two millisecond timestamp offset
Следующее
От: Adrian Cox
Дата:
Сообщение: Re: Two millisecond timestamp offset