I have a timestamp 13 Dec 2018 19:37:18 which I need to convert to 2018-12-13 19:37:18, I am following the below steps but it is giving incorrect timestamp
DateFormat outputFormat = new SimpleDateFormat("YYYY-MM-DD HH:mm:ss");
DateFormat inputFormat = new SimpleDateFormat("DD MMM YYYY HH:mm:ss");
Date date = inputFormat.parse(updatedStartime);
String NewStartTime = outputFormat.format(date);
I am getting the output as 2018-Jan-01 19:37:18, Do I need to convert the MMM to integer month value before formatting the output? what is the correct step to get the expected output?