Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Given a time in the 12 hour format with the suffix, either AM/PM, convert that into a 24 hour format. 12 hour format is hours:minutes:seconds followed by AM or PM, where the hours range is from 0 to 12, minutes range is from 0 to 59, second range is from 0 to 59. 24 hours format is hours:minutes and seconds, where hours range is from 0 to 23, minutes range is from 0 to 59, seconds range is from 0 to 59. All the three components: hours, minutes and seconds are represented in the two digit format

NOTE. Midnight is 12'o clock is 12:00:00 AM in the 12 hour format and it is 00:00:00 in 24 hour format. 12 noon is 12:00:00 PM in the 12 hour format and it is 12:00:00 in the 24 hour format

for example if input is 07:05:45 PM then the output is 19:05:45 and if the input is 07:05:45 AM then the output is 07:05:45

input format:
Time in 12 hour format with suffix, either AM or PM

Output format:
Print time in 24 hour format

Boundary Condition
0< hour, minute and seconds < 60
Meridian Should be either “AM” or “PM”

What I have tried:

well i am very much confused with the problem so i was not able to figure out any solution. Please help me out
Posted
Updated 31-Aug-16 21:39pm
Comments
Mohibur Rashid 31-Aug-16 18:50pm    
The answer is, yes we can.

Nice statement, now you just have yo start to work.
We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
So, start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900