I'm trying to convert a string to date
I tried in couple ways but i'm getting the same.Please could any one help me out.
String stringDate ="20181228184821";
Date date = null;
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMdd HH:mm:ss");
try {
date = sdf1.parse(stringDate);
System.out.println(date);
} catch (ParseException e) {
System.out.println("ICICIBusinessLogic Error in converting input date string ****" + e);
}
I get the following exception :
Error in converting input date string ****java.text.ParseException: Unparseable date: "20181228184821"
SimpleDateFormatclass. It is not only long outdated, it is also notoriously troublesome. Today we have so much better injava.time, the modern Java date and time API.