I would use a timestamp instead of sql date.

ps.setTimestamp(2, new Timestamp(utilDate.getTime());

if you prefer sql date, it's analog.

the current time is : new
Timestamp(Calendar.getInstance().getTime().getTime());

norsch

Norman Schöneich

-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Gesendet: Mittwoch, 17. Oktober 2001 18:15
An: [EMAIL PROTECTED]
Betreff: java.util.Date() into a java.sql.Date
Wichtigkeit: Niedrig


Hi, I have a prepared statement that requires a date for Oracle db.
Basically it is a field that records time and date that record was
created(timestamp). I use this to get time and date :
java.util.Date utilDate = new java.util.Date();
//Now I need to convert this utilDate into a sqlDate to use in a prepared
statement. I need this:  October 17, 2001 11:00:00PM which util gives me but
I cant get it to sql type
ps.setDate(2,sqlDate);


How can I convert or better yet grab the current date/time as a sql.Date to
begin with.
THANKS!!


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to