SimpleDateFormat originalFormat = new SimpleDateFormat("dd MM yyyy");
SimpleDateFormat targetFormat = new SimpleDateFormat("yyyy MM dd HH:mm:ss" );
Date date;
try {
date = originalFormat.parse("21 6 2013");
System.out.println("Old Format : " + originalFormat.format(date));
System.out.println("New Format : " + targetFormat.format(date));
} catch (ParseException ex) {
// Handle Exception.
}
Old Format : 21 06 2013
New Format : 2013 06 21 00:00:00