I need to convert a String timestamp into Date timestamp as the column in database is in Date format. The following is the code (method) I have written which successfully converts the str in the parameter to "yyyy.MM.dd HH:mm:ss" string format but I need it to be converted to Date. Can you please tell how I can do this?
public String convertTimestampToDate(String str) throws ParseException {
Date timestamp = new SimpleDateFormat("yyyyMMddHHmmss").parse(str);
String uploadTime = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss").format(timestamp);
return uploadTime;
}