Date format conversion Android

try this

SimpleDateFormat form = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
java.util.Date date = null;
try 
{
    date = form.parse("2011-03-27T09:39:01.607");
}
catch (ParseException e) 
{

    e.printStackTrace();
}
SimpleDateFormat postFormater = new SimpleDateFormat("MMMMM dd, yyyy");
String newDateStr = postFormater.format(date);

now newDateStr = March 27, 2011;


May be this is of any help;

String convertDate(String inputDate) {

    DateFormat theDateFormat = new SimpleDateFormat("yyyy-MM-dd");
    Date date = null;

    try {
        date = theDateFormat.parse(inputDate);
    } catch (ParseException parseException) {
        // Date is invalid. Do what you want.
    } catch(Exception exception) {
        // Generic catch. Do what you want.
    }

    theDateFormat = new SimpleDateFormat("MMM dd, yyyy");

    return theDateFormat.format(date);
}

Tags:

Java

Date

Android