You may need either a 24-hour value to determine what to add so that you can add the desired format.
public static final String TIME = "hh:mm";
and then
String ampm = Integer.parseInt(time.valueOf("hh")) >= 12 ? "PM" : "AM";
...
return mDateFormat.format(date)+" "+ampm;
Or, if you feel lazy, you can simply do without changing the TIME value:
return mDateFormat.format(date).toUpperCase().replace(".","");
source
share