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.
- Prepare
- Algorithms
- Warmup
- Time Conversion
- Discussions
Time Conversion
Time Conversion
Sort by
recency
|
4912 Discussions
|
Please Login in order to post a comment
I solved this by using the cases of 12 hours in AM to 00, and in 12 hours in PM by letting it as it was. But please, 12 hours clocks dont have 12:01:00 hour. Its from 00:00:00 to 11:59:59. Review your problem.
String s2 =""; if(s.startsWith("12") && s.endsWith("AM")) {
}
else if(s.endsWith("PM")){
} else{ String[] s1 = s.split("AM"); s2=s1[0]; } return s2;
Python 3
I dont think I can make it look cleaner than this.
c#