How to covert date variable to java.sql.date -


i facing difficulties while trying insert date variable database table. variable called:

date date4; 

the date4 variable value read textbox has calendar picker. inserting in date column, setting field type date:

preparedstmt.setdate(4,date4); 

however, got below message after submitting form:

javax.faces.component.updatemodelexception: java.lang.illegalargumentexception: cannot convert 4/1/15 12:00 of type class java.util.date class java.sql.date

also, there way insert field in format of date ("dd-mon-yyyy")?

convert util date sql date

    java.sql.date sqldate = new java.sql.date(date4.gettime()); 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -