I have the following function
public static Date parseDate(String date, String format) throws ParseException { SimpleDateFormat formatter = new SimpleDateFormat(format); return formatter.parse(date); }
I use this as follows in my code
Calendar eDate = Calendar.getInstance(); eDate.add(Calendar.DAY_OF_MONTH,10); Date date = null; try { date = parseDate(eDate.getTime().toString(),"yyyy-MM-dd hh-mm-ss"); } catch (ParseException e) {
But he throws -
java.text.ParseException: Unparseable date
What is the problem?
source share