public static String getTime(String time) {
String ampmTime = null;
SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss", Locale.getDefault());
Date dt;
try {
dt = sdf.parse(time);
SimpleDateFormat sdfs = new SimpleDateFormat("hh:mm a", Locale.getDefault());
if (dt != null) {
ampmTime = sdfs.format(dt);
}
} catch (ParseException e) {
e.printStackTrace();
}
return ampmTime;
}
In parameter string i'm sending 12:00:00 format so please i want this as 12:00pm instead of 12:00am . And others time is showing correctly like 13:30:00 to 1:30pm . So please help me??