I've run into similar problems before, where I was actually getting dates in 3 different iso formats like that, and was pretty frustrated with it... This isn't pretty, but it may help point you in the right direction...
The 3 formats I was getting the info in:
private static final String ISO_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
private static final String ISO_FORMAT2 = "yyyy-MM-dd'T'HH:mm:ss'Z'";
private static final String ISO_FORMAT3 = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
Actually attempting to parse them (without having to figure out the correct type beforehand, returning a new Date Object in the event all 3 failed so shit doesn't crash because of a damn date formatting exception):
public static Date parseIso(String date){
SimpleDateFormat sdf = new SimpleDateFormat(ISO_FORMAT, Locale.US);
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
try {
return sdf.parse(date);
}
catch (ParseException e) {
Log.g(TAG, "Failed 1st date parse with " + ISO_FORMAT + " for " + date);
sdf = new SimpleDateFormat(ISO_FORMAT2, Locale.US);
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
try {
return sdf.parse(date);
}
catch (ParseException e2) {
Log.g(TAG, "Failed 2nd date parse with " + ISO_FORMAT2 + " for " + date);
sdf = new SimpleDateFormat(ISO_FORMAT3, Locale.US);
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
try {
return sdf.parse(date);
}
catch (ParseException e3) {
Log.g(TAG, "Failed 3rd date parse with " + ISO_FORMAT3 + " for " + date);
}
}
}
return new Date();
}
And then for actually converting that date to a localized date:
public static String format(long mils, String format){
return format(getInstance(mils), format);
}
public static String format(Calendar calendar, String format){
SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.US);
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
return sdf.format(new Date(calendar.getTime().getTime() + TimeZone.getDefault().getOffset(new Date().getTime())));
}
public static Calendar getInstance(long timeInMils){
Calendar cal = Calendar.getInstance();
cal.setTimeZone(TimeZone.getTimeZone("UTC"));
cal.setTimeInMillis(timeInMils);
return cal;
}
So now you can basically call
CalendarHelper.format(myDateObject.getTime(), "MMM dd, yyyy");
and it will return the localized, formatted date from the original UTC date you received.
Again, not pretty, but I hope this can point you in the right direction for converting between the UTC and client's time zone. Best of luck~
PS. I think ISO_FORMAT_3 is the one that will actually help you. I guess I probably could have started with that information, but I'm not a bright man.