Converting string date to Java.sql.date -
this question has answer here:
please advise how can convert date getting in string form java.sql.date form..
string dateimp = abcobject.getabcdate(); java.sql.date sd =
at last want convert date gettung in string form java.sql.date
//this convert string date
simpledateformat formatter = new simpledateformat("dd-mmm-yyyy"); string dateinstring = "7-jun-2013"; try { date date = formatter.parse(dateinstring); system.out.println(date); system.out.println(formatter.format(date)); } catch (parseexception e) { e.printstacktrace(); }
/* below code snippet convert java util date sql date use in databases */
java.util.date utildate = new java.util.date(); java.sql.date sqldate = new java.sql.date(utildate.gettime());
Comments
Post a Comment