In my JSP page I have a field which is date and when I getting as request.getParameter("dateVal"); gives me
15-Dec-2012 12:21.
I would like to pass this value to my database procedure and insert/update into table.
How can I pass the value as setDate using prepareCall to database?
Thanks
First step would be using
SimpleDateFormatto parse it to a fullworthyjava.util.Dateinstance in the controller:Then you can just create a
java.sql.Datearound its time in the database layer:Unrelated to the concrete problem, please note that
java.sql.Datedoesn’t remember the time part. If you have actually aDATETIMEorTIMESTAMPfield in the DB and not aDATEfield, then rather usesetTimestamp()with ajava.sql.Timestampinstead. This way the time part will also be stored.