+ 2
I've been doing the military time challenge and my code works in all cases except one. Can anyone tell me where I went wrong?
5 Answers
+ 3
You did reverse.
For 12:00 AM output is 00:00 but giving 12:00
For 12:00 PM output is 12:00 but giving 00:00
+ 2
Input : 12:00 AM
Required Output : 00:00
Input : 1:00 AM (input may have single digit hr)
Required Output : 01:00
Input : 12:00 PM
Required Output : 12:00
May one of these cases failing.
+ 2
Both of you showed me something I hadn't considered and I fixed it now but it's still not working.
+ 1
24:59 isn't a time, that is represented by 00:59 {EDIT: I think you catch 12:xxAM but fail to change it to 00:xx}
Your logic is different to how I've seen it done, but otherwise seems ok. How does it handle 1:49?
{EDIT: I think your logic fails when there is a single digit hour}
+ 1
Thank you very much. Both of you. I have got it now. I did write it in reverse I don't know what I was on that day.