Simple two formatters we have used:
We parse the full date to time format:
date="2016-05-06 16:40:32";
public static String setDateParsing(String date) throws ParseException {
// This is the format date we want
DateFormat mSDF = new SimpleDateFormat("hh:mm a");
// This format date is actually present
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-mm-dd hh:mm");
return mSDF.format(formatter.parse(date));
}