I am trying to convert the String to java.sql.Date
.
This string I am getting from my jsp page using request.getparameter(date);
which will return string and now I am trying to convert this String to Java.util.Date
and then converting to java.SQL.Date
.
For this I am using the below code
DateFormat format=new SimpleDateFormat("MM-dd-yyyy");
java.util.Date parsed = new Date(0);
try {
System.out.println("inside try block");
format.setLenient(false);
parsed = format.parse(dob);
System.out.println("parsed date inside try block"+parsed);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
But the statement parsed=format.parse(dob)
is not executing.