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!

jdbc and dates

843854Nov 26 2001 — edited Nov 27 2001
i have a question regarding dates:

in my java program i created the following sql String:

INSERT INTO RESERVATIE VALUES(1,10,to_date('1987/05/31:12:00:00AM','yyyy/mm/dd:hh:mi:ssam'),to_date('1998/05/31:12:00:00AM','yyyy/mm/dd:hh:mi:ssam'),'Vettigen','Dre')

stmt.executeUpdate(sql);
con.commit();

this works fine.

Now i want to retrieve the "dateString" somewhere else in the program.
for example:

sql="SELECT * FROM table_name";
Statement stmt= con.createStatement();
ResultSet rst = stmt.executeQuery(sql);
while(rst.next()){
String myDate = rst.getString(3);
}

now if i print the String object myDate i get : 1998-05-31: 00:00:00.0

It seams that i lost the hour/minutes/seconds fields. How can i get them from the Oracle db?

thx
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 25 2001
Added on Nov 26 2001
5 comments
75 views