I'm trying to convert this to a readable format however, keep getting java.text.ParseException: Unparseable date: "2016-11-18T11:13:43.838Z" (at offset 23)
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.US);
try {
Date date1 = df.parse("2016-11-18T11:13:43.838Z");
DateFormat outputFormatter1 = new SimpleDateFormat("dd-MMM-yyyy");
String output1 = outputFormatter1.format(date1); //
} catch (ParseException e) {
e.printStackTrace();
}
I read about adding locale as other SO answers suggested but it is still not working.
SimpleDateFormat
. Like this:DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
– TecumsehZ
is the zero timezone, equivalent to+0000
. – Komarek