Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
1. Create a SimpleDateFormat object with a date pattern that matches the input string. 2. Parse the input string into a java.util.Date object using that SimpleDateFormat object. 3. Create a SimpleDateFormat object with a date pattern for the output. 4. Format the Date object that you got in step 2 into a string with that SimpleDateFormat.
First of all, note that in the date pattern string, case is important. So "eee" is not the same as "EEE". The lower-case letter "m" is for minutes, the upper case letter "M" is for month. So it doesn't work if you specify "mmm" while you mean "MMM".
I experimented with it a bit for you. If the names of the days and months are in English, you have to set the locale of the SimpleDateFormat that you are using to parse the first date correctly (if the default language of your system isn't English), otherwise it won't understand the English day and month names.
While experimenting I had trouble with parsing the timezone information "GMT+0530". This format isn't a standard timezone string format as Java accepts it. Java accepts either "GMT+05:30" (with a colon in it) or "+0530" with the following pattern: