You are viewing a single comment's thread. Return to all comments →
This is my C++ solution for this problem. Hope! You wil find it useful.
string timeConversion(string s) { string hr = s.substr(0,2); int h = stoi(hr); if (s[8]=='P') { if(h!=12) h = h + 12; s.replace(0,2,to_string(h)); } if(s[8]=='A' && h==12 ){ s.replace(0,2,"00"); } s.erase(8,2); return s; }
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 →
This is my C++ solution for this problem. Hope! You wil find it useful.