You are viewing a single comment's thread. Return to all comments →
public static String timeConversion(String s) { int hour = Integer.parseInt(s.substring(0, 2)); if(s.endsWith("AM") && hour == 12){ return "00" + s.substring(2, s.length() - 2); } else if(s.endsWith("PM") && hour < 12){ return String.valueOf(hour + 12) + s.substring(2, s.length() - 2); }else{ return s.substring(0, s.length() - 2); } } }
Seems like cookies are disabled on this browser, please enable them to open this website
Time Conversion
You are viewing a single comment's thread. Return to all comments →