I am trying to format date string ex. 2014-11-24T18:30:00.000Z
to 2014-11-24
using this code below:
SimpleDateFormat dateFormat = new
You have to parse the string first as a date and then format the date:
SimpleDateFormat dateFormatP = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
Date parsedDate = dateFormatP.parse(reqJsonObj.getString(FROM_DATE));
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
dateFormat.format(parsedDate );