What is the easiest way to convert 23-Mar-2011 to 23-03-2011 in Java?
Thanks to everyone. This seems to solve the problem:
try { Calendar cal = Calendar.getInstance(); cal.setTime(new SimpleDateFormat("dd-MMM-yyyy").parse("24-Nov-2002")); SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); System.out.println(sdf.format(cal.getTime())); } catch (ParseException e) { e.printStackTrace(); }
java date
Viren pushpanayagam
source share