You are viewing a single comment's thread. Return to all comments →
any guesses why this code is giving an error?
public static String timeConversion(String s) { String newTime = "";
String temp = ""; String no = ""; if(s.charAt(s.length()-2)=='A' && Integer.valueOf(s.substring(0,2))==12) temp.concat("00:");
else if(s.charAt(s.length()-2)=='A') temp.concat(s.substring(0,3));
if(s.charAt(s.length()-2)=='P'){
int hel = Integer.valueOf(s.substring(0,2)); hel+=12; if(hel==24) temp = newTime.concat("00:"); else temp = newTime.concat(hel+":");
}
String Final = temp.concat(s.substring(3,8)); return Final;
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 →
any guesses why this code is giving an error?
public static String timeConversion(String s) { String newTime = "";
else if(s.charAt(s.length()-2)=='A') temp.concat(s.substring(0,3));
if(s.charAt(s.length()-2)=='P'){
}
String Final = temp.concat(s.substring(3,8)); return Final;