How do I take date as input in Java and be able to add/subtract its days/months/years
I'm currently using this code and I don't know if there is a way to add or subtract the date that I input with Scanner(System.in)
Scanner scanner = new Scanner(System.in);
System.out.println("Date: ");
String date = scanner.next();
SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
Date date2=null;
try {
date2 = dateFormat.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}