From: | Peter T Mount <peter(at)retep(dot)org(dot)uk> |
---|---|
To: | Aleksey Demakov <avd(at)gcom(dot)ru> |
Cc: | pgsql-interfaces(at)postgresql(dot)org |
Subject: | Re: JDBC date problem |
Date: | 1998-10-16 17:17:33 |
Message-ID: | Pine.LNX.3.96.981016181111.31130N-100000@maidast.retep.org.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
On 16 Oct 1998, Aleksey Demakov wrote:
>
> Can you believe me?
>
> I have a table with a column which is to store the dates each row was
> created. I fill it with the line:
>
> insert_stmt.setDate(2, new Date (System.currentTimeMillis ()));
>
> And every day I insert a new row I can see that I did it tomorrow!
>
> I have found that in the method PreparedStatement.setDate() the date
> argument is intentionally incremented by one. The comments there say
> that it's to compensate broken SimpleDateFormat. Apparently, my
> SimpleDateFormat is ok (JDK 1.1.7 for win95/nt and jdk1.1.5 for freebsd).
Yep. Prior to JDK 1.1.6, setDate() had a bug, where it stored the date 1
day earlier than it really was. I tested both Linux & Win95/nt jdk's, and
this seemed consistent.
About 1 1/2 months ago, I found that 1.1.6 fixed it, so I removed the
increment from the source.
The V6.4 beta driver effectively only works for 1.1.6 or later JDK for the
setDate() method.
--
Peter T Mount peter(at)retep(dot)org(dot)uk
Main Homepage: http://www.retep.org.uk
PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres
Java PDF Generator: http://www.retep.org.uk/pdf
From | Date | Subject | |
---|---|---|---|
Next Message | Peter T Mount | 1998-10-16 17:19:06 | Re: [INTERFACES] driver |
Previous Message | Andrea Antibo | 1998-10-16 07:25:56 | Re: [INTERFACES] applet |