Convert time to 24 hour clock c

broken image
broken image

For example: 2:00 PM = (2 + 12):00 = 1400, 5:30 PM = (5 + 12):30 = 1730, 11:59 PM = (11 + 12) = 2359 in military time.Īfter 23:59 PM the 12-hour clock turns to 12:00 AM which corresponds to midnight, at which point military time is reset to 0000 (the beginning of the day) and the process continues. Within these intervals above the hours and minutes remain the same.Īfter and including 1:00 PM until 11:59 PM, you should add 12 to the hours to make the corresponding military time. After 12:59 AM the 12-hour clock jumps to 1:00 AM = 0100 in military time. It starts at 0000, which corresponds to 12:00 AM.

broken image

Military time or 12-hour military notation consists always of four digits. In military time the day runs from midnight to midnight and is divided into 24 hours from 00:00 (midnight) to 23:59. In 12-hour clock or 12-hour time notation the day is split into two 12-hour periods running from midnight (12:00 AM) to noon (12:00 PM), and noon to midnight. The first one is the 12-hour clock which uses AM and PM, and the other is the 24-hour clock. There are two main methods of displaying the time. How to convert time from 12-hour clock to 24-hour clock and to military time

broken image