Convert from 24-hour to 12-hour time format and vice versa.

Wahid Hasan
3 min readAug 21, 2021

Some students are confused when they see a digital clock with a 24-hour display and wonder what time it is. This blog is for those who find it simple to recognise 24-hour time in 12-hour format. We can also see a conversion from 12-hour to 24-hour time. Let’s get started…

We all know that one day is equal to 24 hours. In a 12-hour clock, the day is divided into two periods: a.m. (ante meridian, which means “before midday”) and p.m. (post meridian, which means “after midday”). Each period is 12 hours long. On the other hand, the 24-hour clock, is a method of telling time in which the day runs from midnight to midnight and the hours are numbered from 0 to 23.

A single number line can be used to express 12-hour and 24-hour formats, as shown below.

Time-based number line

Convert 24-hour format to 12-hour format

Before 12 o’clock, both the 12-hour and 24-hour numbers on the above time-based number line are the same. A new day begins at midnight, 00:00 means 12 a.m. in 12-hour format. The numbers 01 through 11 are the same in both the 12-hour and 24-hour formats. A day is divided into two periods in a 12-hour clock, so 12 is denoted as 12 p.m. In a 24-hour format, deduct 12 hours from the provided hour and add pm to the end of the time. For example, if the time is 18:56 in 24-hour format, it will be (18:56–12:00) = 6:56 pm in 12-hour format. So,

Convert 12-hour format to 24-hour format

The process for converting 12 hours to 24 hours is the same as before. It is 00 hour in a 24-hour clock when the time is 12 a.m. When the hour is 01 to 11 a.m., the 24-hour clock will remain the same. Whenever the time exceeds 12 p.m., add 12 hours to the specified hour. For example, 6:56 p.m., is in 12-hour format, whereas (6:56 + 12:00) = 18:56 is in 24-hour format.

You may easily convert time from one format to another by using the above rules.

Happy Learning!!!

--

--

Wahid Hasan
0 Followers

A self motivated software developer with a zest for new challenges. Currently working with React, Typescript, Asp .Net Core and more.