I have a string in the form "2013-09-18". I want to convert it into a java.util.Date. I am doing this
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date convertedCurrentDate = sdf.parse(currentDateText);
The convertedCurrentDate is coming as 'Wed Sep 18 00:00:00 IST 2013'
I want my output in the form '2013-09-18'
Hour, minutes and seconds shouldnt come and it should be in the form yyyy-MM-dd.
See Question&Answers more detail:os