OAF – Conversion of Java Date in Different Formats
private java.sql.Date stringToDate(String dateS)
{
///String into Java.util.date
// java.util.Date into java.SQL.Date
java.sql.Date sqlStartDate = null;
if (dateS != null && !"".equals(dateS)) {
String dateFormat = "yyyy-MM-dd";
SimpleDateFormat df = new SimpleDateFormat(dateFormat);
java.util.Date parsedDate1 = null;
{
try {
parsedDate1 = df.parse(dateS); // String into DB
} catch (ParseException e) {
System.out.println("exception occurred in conversion ");
throw new OAException("Formatting Issue, Unable to Parse Data") ;
// TODO
}
sqlStartDate = new java.sql.Date(parsedDate1.getTime());
}
}
return sqlStartDate;
}
Comments |0|
Category: OAF