You are viewing a single comment's thread. Return to all comments →
For people interested in C, a simple elegant solution with low complexity :
int main() { int hh, mm, ss ; char t12[3]; scanf("%d:%d:%d%s", &hh, &mm, &ss, t12) ; if (strcmp(t12,"PM")==0 && hh!=12) hh += 12 ; if (strcmp(t12,"AM")==0 && hh==12) hh = 0 ; printf("%02d:%02d:%02d", hh, mm, ss) ; return 0; }
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 →
For people interested in C, a simple elegant solution with low complexity :