String format: MM/DD/YYYY
public Timestamp convertStringToDate(String newDate) {
try {
DateFormat formatter;
Date date;
formatter = new SimpleDateFormat("MM/dd/yyyy");
date = (Date)formatter.parse(newDate);
java.sql.Timestamp timeStampDate = new Timestamp(date.getTime());
return timeStampDate;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
Timestamp format : MM/DD/YYYY 00:00:00
No comments:
Post a Comment