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