Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Date to timestamp conversion

296002Jul 15 2003
Hello Everyone I have a DB type field
TimeStamp in oracle and
Date Type field in Java Class...

Can any one suggest me the optimal way to insert and retrive this value ..

I mean if I insert
{ts '2003-07-15 16:52:09.14'}

It should be
'2003-07-15 16:52:09.14'
in Date Type of class...

Currently what is happening is

Timestamp ts=_rs.getTimestamp(columnIndex);
if(ts==null) return null;
Date d1= new Date(ts.getTime());
Date d= new Date(ts.getTime() + (ts.getNanos()/1000000));
if(convertb) d = Util.ReferenceTZ2Local(d);
return new JDatetime(d);
}


I am doing this and it get converted to something else
2003-07-15 16:52:09.420
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 12 2003
Added on Jul 15 2003
0 comments
307 views