I have a method which reads the date that in form of srring and then conver it format in dd-MM-yy and finally return a string as shown below..
public static String getSimpleDate11(String dateString) {
if (dateString == null) {
return null;
}
DateFormat dfIn = new SimpleDateFormat("yyyy-MM-dd");
DateFormat dfOut = new SimpleDateFormat("dd-MM-yy");
try {
Date date = dfIn.parse(dateString);
return dfOut.format(date);
} catch (ParseException e) {
throw new RuntimeException(
"The date entered is invalid or has incorrect format"
+ dateString);
}
}
now I am calling this method from somewhere as shown below....
String formatteddate = DateUtility.getSimpleDate11(settlementDate);
now please advise how can I change this in java.sql.Date as I want to store the date in java.sql.Date..
java.sql.Date sd ------ here i want tio store the date finally
folks ple\ase advise .