We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Time Conversion
- Discussions
Time Conversion
Time Conversion
Sort by
recency
|
776 Discussions
|
Please Login in order to post a comment
public static String timeConversion(String s) { // Write your code here int hour = Integer.parseInt(s.substring(0, 2)); String meridian = s.substring(s.length() - 2);
Simple C# solution using DateTimeConverter
CPP lang
string timeConversion(string s) { bool isPm = s[8] == 'P' ? true : false; int hh = stoi(s.substr(0,2)); string mm = s.substr(3,2); string ss = s.substr(6,2);
}
Simple Python solution: