This content has been marked as final. Show 2 replies
alex_t88 wrote:SimpleDateFormat parse = new SimpleDateFormat("MM/dd/yyyy");
Hi, I am trying to write a program that reads a string for a date in the format mm/dd/yyyy and display it in the typical European format of dd.mm.yy
SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy");
I'll leave the rest for you. Check out parse and format methods, and read the javadocs.
There are two main approaches that pop to mind:
1) Use two SimpleDateFormats, one to parse the original String into a Date, and the other to format that Date into a String in the desired format.
2) Just use String.replaceAll to reformat it, since the new string will have the same components in a different order, +/- some constants.