I am trying to change from standard ISO 8601 format 2014-09-11T21:28:29.429209Z into a nice MMM d yyyy hh:mm z format, however my current code is failing.
public void setCreatedAt(String dateTime) {
SimpleDateFormat sdfSource = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.getDefault());
SimpleDateFormat sdfTarget = new SimpleDateFormat("MMM d yyyy hh:mm a z", Locale.getDefault());
try {
Date date = sdfSource.parse(dateTime);
String createdAt = sdfTarget.format(date);
Log.e(TAG, "setCreatedAt: createdAt " + createdAt);
} catch (ParseException e) {
e.printStackTrace();
}
}