You are viewing a single comment's thread. Return to all comments →
C++
string timeConversion(string s) { int hour = stoi(s.substr(0,2)); if (s[8] == 'P') { return (hour == 12) ? s.substr(0, 8) : to_string(hour + 12) + s.substr(2,6); } else { return (hour == 12) ? "00" + s.substr(2, 6) : s.substr(0, 8); } }
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 →
C++