I want to change date format in JAVA as in below. Please help.
-> input is of java.util date datatype (Sat Jan 20 00:00:00 IST 2018)
EX-
Calendar c = Calendar.getInstance();
Date input = c.getTime();
System.out.println(input);//prints[Sat Jan 20 00:00:00 IST 2018]
-> Output should be of java.util date datatype (2018-01-20) EX-
Date output = null;
output = **[logic to convert input to 2018-01-20]**
System.out.print(output);//should print 2018-01-20
I am getting output in String format.
Please help me to find the output in Date format