| From: | Oliver Jowett <oliver(at)opencloud(dot)com> |
|---|---|
| To: | Adrian Cox <adrian(at)humboldt(dot)co(dot)uk> |
| Cc: | pgsql-jdbc(at)postgresql(dot)org |
| Subject: | Re: Two millisecond timestamp offset |
| Date: | 2005-09-09 14:25:36 |
| Message-ID: | 43219B60.2050706@opencloud.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Adrian Cox | 2005-09-09 15:03:25 | Re: Two millisecond timestamp offset |
| Previous Message | Adrian Cox | 2005-09-09 11:18:30 | Two millisecond timestamp offset |