Do not use the outdated date/time API. Do it using modern date/time API as follows:
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
public class Main {
public static void main(String[] args) throws Exception {
DateTimeFormatter inputFormat = DateTimeFormatter.ofPattern("dd-MMM-yyyy");
DateTimeFormatter outputFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String strDate = "30-Dec-2019";
LocalDate date = LocalDate.parse(strDate, inputFormat);
System.out.println(outputFormat.format(date));
}
}
Output:
2019-12-30
Check this to learn about the drawbacks of the outdated date/time API and the benefits of modern date/time API.