+ 16

[ASSIGNMENT] 24 hours to 12 hours format.

Given a String in hh:mm:ss 24 hours format,write a program to convert the time to 12 hours format followed by 'AM' or 'PM'. For e.g: If input is '22:47:00' The output should be '10:47:00 PM' If input is '02:35:36' The output should be '02:35:36 AM'

29th Mar 2018, 3:40 PM
Mitali
Mitali - avatar
27 Answers
31st Mar 2018, 10:38 AM
LukArToDo
LukArToDo - avatar
+ 8
https://code.sololearn.com/cLvA8OtK5SKF/?ref=app
31st Mar 2018, 12:31 PM
D_Stark
D_Stark - avatar
+ 7
Ace I submit the challenges in Lesson Factory so they can be made assignments.But till they get approved as assignment I post them as challenges.
29th Mar 2018, 3:56 PM
Mitali
Mitali - avatar
30th Mar 2018, 6:18 AM
Käzî Mrîdùl Høssäîn
Käzî Mrîdùl Høssäîn - avatar
+ 5
Käzî Mrîdùl Høssäîn The code is awesome. Thanks for taking part.
30th Mar 2018, 6:30 AM
Mitali
Mitali - avatar
+ 5
Coder++ Its perfect now.👍👍
1st Apr 2018, 4:46 PM
Mitali
Mitali - avatar
+ 4
mitali jadhavrao.. welcome
30th Mar 2018, 6:39 AM
Käzî Mrîdùl Høssäîn
Käzî Mrîdùl Høssäîn - avatar
1st Apr 2018, 10:25 AM
Coder++
Coder++ - avatar
+ 3
You can use the following test cases to see if your code works for all conditions: When input is "00:23:45"the output should be "12:23:45AM". When input is "12:34:45" the output should be "12:34:45PM". When input is"21:12:15" the output should be "09:12:15PM". When input is "07:11:45"the output should be "07:11:45AM".
1st Apr 2018, 12:29 PM
Mitali
Mitali - avatar
+ 3
thank you mitali
1st Apr 2018, 7:38 PM
Coder++
Coder++ - avatar
2nd Apr 2018, 8:15 AM
Paul
Paul - avatar
+ 2
https://code.sololearn.com/c0UzTemxKzL3/?ref=app https://code.sololearn.com/w532TLF1dibT/?ref=app
29th Mar 2018, 7:37 PM
hinanawi
hinanawi - avatar
+ 2
D Janapriya Good code.👍 Although it would be great if we could give input as hh:mm:ss.
31st Mar 2018, 12:53 PM
Mitali
Mitali - avatar
+ 2
@mitali jadhavrao I make some changes please check if it works correctly
1st Apr 2018, 4:25 PM
Coder++
Coder++ - avatar
31st Mar 2018, 6:52 AM
D Janapriya
D Janapriya - avatar
+ 1
Coder++ when input is 12:34:45 ...the output should be 12:34:45pm Also when input is 00:12:34 the output should be 12:12:34am Please check for this cases.
1st Apr 2018, 11:22 AM
Mitali
Mitali - avatar
+ 1
~ swim ~ No it should be 22:03:23
1st Apr 2018, 11:38 AM
Mitali
Mitali - avatar
+ 1
~ swim ~ Good try. It passed all the cases I was lookin for.
1st Apr 2018, 11:40 AM
Mitali
Mitali - avatar
+ 1
Paul Jacobs Its perfect.👍 Thanks for participating.
2nd Apr 2018, 8:28 AM
Mitali
Mitali - avatar