I need to take a date from user using JdateChooser then Increment in the days of that date by 2 then save the date in database.
I am using eclipse and this is the code I am trying;
DateFormat df=new SimpleDateFormat("dd-MM-yyyy");
String ADate=df.format(dateChooser.getDate());
Date date = df.parse(ADate); //Error comes here
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_MONTH, 2);
Date futureDate = cal.getTime();
String outD=df.format(futureDate); //And also here
System.out.println(outD);
I always get error:
java.util.date can not be cast to java.sql.date