Attached is an example piece of code that does a simple timestamp insert
using a prepared statement. Note that there is no method setDate (int,
java.util.Date), only setDate (int, java.sql.Date).
java.sql.Date only stores the Date part - it deletes the time value. So you
must use setTimestamp (int, java.sql.Timestamp) to retain the time part. The
"set date format" tells IDB how to output the value as a String.
Hope this helps.
Instant Computer Solutions
From: Rich Coad <email@example.com>
To: firstname.lastname@example.org <email@example.com>
Cc: firstname.lastname@example.org <email@example.com>
Date: 06 December 1999 22:28
Subject: Date Columns
>I am having trouble with getting dates with greater granularity than days
>of the InstantDB database.
>The dates are added to the database as a java.util.Date object. When I
>them as they are entered the date is something like Mon Dec 06 10:25:00 PST
>When I retrieve dates from the database they always appear as Dec 06 1999
>the time appears as 4:00 p.m.
>It appears as though the time is being discarded in the database and, when
>retrieve it, a default of 00:00:00 GMT is being appended which then becomes
>I have tried using a dateFormat setting in the properties file and also a
>to SET DATE FORMAT prior to creating the table. Neither had any effect.
>I also tried wrapping the column name in the select with a call to the
>function. This resulted in a SQLException being thrown.
>Does anyone have experience with getting times down to the granularity of a
>second from InstantDB?
>Te audire no possum. Musa sapientum fixa est in aure.
>To unsubscribe from this list, please an send
>email to 'firstname.lastname@example.org' with the text
>'unsubscribe instantdb' in the message body.