You are viewing a single comment's thread. Return to all comments →
my solution in C#:
public static string timeConversion(string s) { string hour = s.Substring(0,2); string amPm = s.Substring(s.Length - 2, 2); if (hour.Equals("12")) { if (amPm.Equals("AM")) { return "00" + s.Substring(2, s.Length - 4); } else { return s.Substring(0, s.Length - 2); } } else { if (amPm.Equals("AM")) { return s.Substring(0, s.Length - 2); } else { return (int.Parse(hour) + 12).ToString() + s.Substring(2, s.Length - 4); } } }
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 →
my solution in C#: