Rich
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.
Regards
Peter Hearty
Instant Computer Solutions
-----Original Message-----
From: Rich Coad <rich@isyndicate.com>
To: instantdb@smartcard.co.uk <instantdb@smartcard.co.uk>
Cc: brad@isyndicate.com <brad@isyndicate.com>
Date: 06 December 1999 22:28
Subject: Date Columns
>I am having trouble with getting dates with greater granularity than days
out
>of the InstantDB database.
>
>The dates are added to the database as a java.util.Date object. When I
llok at
>them as they are entered the date is something like Mon Dec 06 10:25:00 PST
1999
>When I retrieve dates from the database they always appear as Dec 06 1999
and
>the time appears as 4:00 p.m.
>
>It appears as though the time is being discarded in the database and, when
I
>retrieve it, a default of 00:00:00 GMT is being appended which then becomes
4
>p.m PST
>
>I have tried using a dateFormat setting in the properties file and also a
call
>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
TO_DATE
>function. This resulted in a SQLException being thrown.
>
>Does anyone have experience with getting times down to the granularity of a
>second from InstantDB?
>
>Thanks,
>
> --
>Rich Coad
>Tech Team
>iSyndicate.com
>(415) 430-2369
>Te audire no possum. Musa sapientum fixa est in aure.
>To unsubscribe from this list, please an send
>email to 'majordomo@smartcard.co.uk' with the text
>'unsubscribe instantdb' in the message body.
simple.java
|