I want to convert a string to Timestamp. Here is the sample code.
I want to parse the string to Timestamp..
I have tried to convert it like String date format is "18/01/11";
String date = "25/07/2017";
Timestamp ts =Timestamp.valueOf(date);
DateUtil.convertDate(ts.toString());
convertDate:-
SimpleDateFormat inputFormat = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss");
Date d = null;
try {
d = inputFormat.parse(input);
} catch (ParseException e) {
System.out.println("Date Format Not Supported");
e.printStackTrace();
}
SimpleDateFormat outputFormat = new SimpleDateFormat("dd/MM/yyyy");
return outputFormat.format(d).toString();
if I write like that i am getting the following error
Date Format Not Supported
Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]