Yes. It can be done in two parts as follows:
Parse your String
to Date
object
SimpleDateFormat sd1 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
Date dt = sd1.parse(myString);
Format the Date
object to desirable format
SimpleDateFormat sd2 = new SimpleDateFormat("yyyy-MM-dd");
String newDate = sd2.format(dt);
System.out.println(newDate);
You will have to use two different SimpleDateFormat
since the two date formats are different.
Input:
2015-01-12T10:02:00+0530
Output:
2015-01-12