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

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -