my input String is : 2010-03-24T17:28:50.000Z
output pattern is like:
DateFormat formatter1 = new SimpleDateFormat(\"EEE. MMM. d. yyyy\");
The problem is in this part:
new Date("2010-03-24T17:28:50.000Z")
Apparently it doesn't accept dates/times in that format.
You shouldn't be using that constructor anyway - create an appropriate formatter to parse that particular format, and then parse it with that.
Alternatively, use Joda Time to start with, and avoid using DateFormat
completely. I don't know if you can use Joda Time from Android, mind you... and it's fairly large.
EDIT: To spell it out explicitly:
String inputText = "2010-03-24T17:28:50.000Z";
// "Z" appears not to be supported for some reason.
DateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
inputFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
DateFormat outputFormat = new SimpleDateFormat("EEE. MMM. d. yyyy");
Date parsed = inputFormat.parse(inputText);
String outputText = outputFormat.format(parsed);
// Output is Wed. Mar. 24 2010 on my box