I have searched google and I cannot find out how you can take a string: xx:xx AM/PM (ex. 3:30 PM) and change it so that it is now in 24 hours.
So for e
You can easily use this method to convert AM/PM time to 24-hour format. Simply pass 12Hour format time to this method.
public static String convert_AM_PM_TimeTo_24(String ampmtime){
SimpleDateFormat sdf = new SimpleDateFormat("hh:mm a");
Date testTime = null;
try {
testTime = sdf.parse(ampmtime);
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
String newFormat = formatter.format(testTime);
return newFormat;
}catch(Exception ex){
ex.printStackTrace();
return ampmtime;
}
}