> prep.setTimestamp(1, new Timestamp(date.getTime()/1000));
>
> will do the right thing.
Oh you're right. I didn't read the Java API closely enough, so I
didn't realise the API was going to do something entirely brain-dead.
My code was just calling Timestamp.getTime() and using the long value,
but it turns out that:
This type is a composite of a java.util.Date and a separate
nanoseconds value. Only integral seconds are stored in the
java.util.Date component. The fractional seconds - the
nanos - are separate.
Of course! Let's make the subclass behave in no way like the original
class. But you have to wonder, if they're going to put notes like this
in the JavaDoc:
Due to the differences between the Timestamp class and the
java.util.Date class mentioned above, it is recommended that
code not view Timestamp values generically as an instance
of java.util.Date.
Why did they subclass java.util.Date in the first place?
There will be a new version later today, or tomorrow that fixes this.
d.
--~--~---------~--~----~------------~-------~--~----~
Mailing List: http://groups.google.com/group/sqlitejdbc?hl=en
To unsubscribe, send email to [EMAIL PROTECTED]
-~----------~----~----~----~------~----~------~--~---