Following code
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MMM-yy", new DateFormatSymbols(Locale.US));
System.out.println(simpleDateFormat.parse("03-Apr-96"));
Gives output as Wed Apr 03 00:00:00 IST 1996
What should I do get the output like 1996-04-03 00:00:00.0
A
DateFormatobject can be either used to parse aStringinto aDateobject or the other way around. In your example, you’re doing the former, when what you really want to do is to format yourDateinto a given pattern.Here’s an example of what you may want to do: