You are viewing a single comment's thread. Return to all comments →
I don't know if it's considered "cheating", but I used a real datetime parser:
import java.time.format.DateTimeFormatter; import java.time.LocalTime; (...) public static String timeConversion(String s) { DateTimeFormatter sourceFormat = DateTimeFormatter.ofPattern("hh:mm:ssa"); DateTimeFormatter targetFormat = DateTimeFormatter.ofPattern("HH:mm:ss"); String formattedTime = LocalTime.parse(s, sourceFormat).format(targetFormat); return formattedTime; }
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 →
I don't know if it's considered "cheating", but I used a real datetime parser: