This question already has an answer here:
-
java.util.Date format conversion yyyy-mm-dd to mm-dd-yyyy
6 answers
Has java any function where I have a String with a date in this form : ddMMyy
or dd.MM.yy
and I want to convert it in another format like: dd:MM:yy
I would suggest using two SimpleDateFormat objects for this.
Date date = new SimpleDateFormat("ddMMyy").parse( dateString);
String result = new SimpleDateFormat("dd:MM:yy").format( date );
For the format, see the documentation: http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html