I getting a crash while getting this date format from server side and then i have been analyzed in google but didn't get any right solution for this.How to convert this date format to this way attached below Crash occurred in "startDate":"2018-01-23T00:00:00.000-05:00" this date
Expected date format:"2018-01-24 00:43:10 -0500" Suggest some possible solutions.
SimpleDateFormat inFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
inFormat.setTimeZone(TimeZone.getDefault());
String date = null;
try {
Date toConvert = inFormat.parse(OurDate);
date = inFormat.format(toConvert);
} catch (ParseException e) {
e.printStackTrace();
}
return date.toString();
}