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
|
839 Discussions
|
Please Login in order to post a comment
Why doesn't this work?
Can we not utilize date objects for this? I think it makes it more robust TBH
python3 solution using modulo:
public static String timeConversion(String s) { int n = s.length(); String period = s.substring(n - 2); // Extract AM or PM int hour = Integer.parseInt(s.substring(0, 2)); // Extract hour part String minAndSec = s.substring(2, n - 2); // Extract minutes and seconds
}