Military Time Converter: 24-Hour to 12-Hour Clock
Convert military time to standard time and back. Reads 2330, 23:30 and 11:30 PM, and explains 0000 and 2400 midnight, noon, 12 AM and 12 PM.
Military Time Converter
Type a time in either notation. The converter reads 2330, 23:30 and 11:30 PM, and writes the same reading in both.
The same time in both notations
Documentation
Military Time Converter
Military time is the 24-hour clock: the hours are numbered 00 to 23 and a reading is normally written as four digits with no separator, such as 2330 for half past eleven at night. This page converts a written time between that notation and the ordinary 12-hour clock, in either direction, and also counts the reading in minutes and hours from midnight.
What the calculator does
The converter reads one written time and decides for itself which notation it is in. An AM or PM marker means a 12-hour time. No marker means a 24-hour time. That rule settles the one shape that looks the same either way: a bare 12:30 carries no marker, so it is read as 24-hour time, which is half past noon.
Accepted entries include four digits (2330), three digits (745), a bare hour (8), the colon form (23:30), a 12-hour time with a marker (11:30 PM, 7 pm, 11:30 p.m.), and the spoken suffix (2330 hours, 0800 hrs), which is removed before the digits are read. In a three or four digit entry the last two digits are always the minutes, so 745 is 7:45.
The result is the same reading in three written forms, plus two counts: the four-digit military form, the same time as HH:MM, the 12-hour form with AM or PM, the minutes since midnight, and that count expressed in hours.
How to convert 12-hour time to military time
Take the hour as written, replace 12 by 0, and add 12 if the marker is PM. The minutes never change. In symbols:
where H is the hour on the 24-hour clock, from 0 to 23; h is the hour as written on the 12-hour clock, from 1 to 12; and p is 1 for PM and 0 for AM. The operation written mod is the remainder after division, so 12 mod 12 is 0 and 7 mod 12 is 7.
The remainder is the whole trick. It turns 12 AM into hour 0 and 12 PM into hour 12 from one expression. Writing the two cases out by hand instead is where this conversion is usually got wrong, because they look symmetric and are not.
How to convert military time to 12-hour time
Going the other way, the hour is the remainder again, except that a remainder of 0 is written as 12:
12 & \text{if } H \bmod 12 = 0 \\ H \bmod 12 & \text{otherwise} \end{cases}$$ The marker is AM for hours 0 to 11 and PM for hours 12 to 23. The 12-hour form drops the leading zero on the hour but keeps it on the minutes, so hour 8 and minute 5 is written 8:05 AM. ### Minutes and hours since midnight The page also reports how far into the day the reading falls. Both counts come from one integer: $$t = 60H + m$$ $$T = \frac{t}{60}$$ where *m* is the minutes, from 0 to 59; *t* is the minutes since midnight, from 0 to 1440; and *T* is the same amount in hours. The hours card divides the minute count once rather than adding a fraction to the hour. The two routes disagree on 39 of the 1440 readings, because a computer stores fractions in binary and one sixtieth has no exact binary form. Only this one division produces a fraction anywhere on the page, and nothing in the conversion depends on its value. The card shows four decimal places, which is enough to keep all 1440 readings apart, since one minute is about 0.0167 hours. ### Worked example For 2330 the page reads hour 23 and minute 30, and no marker, so the input is a 24-hour time. The 12-hour hour: 23 mod 12 is 11, and 11 is not 0, so the hour is 11. The hour 23 is 12 or more, so the marker is PM. The reading is 11:30 PM. Minutes since midnight: 60 times 23 is 1380, and 1380 plus 30 is 1410. In hours: 1410 divided by 60 is 23.5. A second example runs the other way. For 7:45 PM the marker gives *p* as 1, and 7 mod 12 is 7, so the hour is 7 plus 12, which is 19. The military form is 1945 and the colon form is 19:45. Minutes since midnight: 60 times 19 is 1140, plus 45 is 1185, which is 19.75 hours. ### Common conversions | Military | 24-hour | 12-hour | Minutes since midnight | |---|---|---|---| | 0000 | 00:00 | 12:00 AM (midnight) | 0 | | 0600 | 06:00 | 6:00 AM | 360 | | 0800 | 08:00 | 8:00 AM | 480 | | 1200 | 12:00 | 12:00 PM (noon) | 720 | | 1330 | 13:30 | 1:30 PM | 810 | | 1800 | 18:00 | 6:00 PM | 1080 | | 2100 | 21:00 | 9:00 PM | 1260 | | 2330 | 23:30 | 11:30 PM | 1410 | | 2400 | 24:00 | 12:00 AM (midnight) | 1440 | ### Midnight: 0000 and 2400 Both forms are in use, and they are not interchangeable. ISO 8601 gives one date two midnights and writes them differently. 00:00 starts the day, and 24:00 ends it, which is the same instant as 00:00 of the next day. When a reading has to be unambiguous, 00:00 is the usual preference. The page keeps whichever form was typed. 0000 comes back as 0000 and is described as the start of a day; 2400 comes back as 2400 and is described as the end of one. Both are 12:00 AM in 12-hour notation, because that notation has no separate end-of-day spelling. Only 2400 counts as 1440 minutes since midnight. The 2400 form is accepted only with zero minutes. An entry of 24:30 is refused rather than quietly turned into 00:30, and the hour 24 is caught before any remainder is taken, since running it through a comparison against 12 would label midnight PM. Source for the two-midnight rule and the preference for 00:00: Markus Kuhn's ISO 8601 summary at the University of Cambridge, which is written against ISO 8601:2004. The later history is cited separately, to the standard's own revisions: ISO 8601-1:2019 as published dropped the 24:00 representation, and ISO 8601-1:2019/Amd 1:2022 reinstated it. ### 12 AM and 12 PM Noon is neither before nor after itself, so the labels a.m. (before midday) and p.m. (after midday) do not really apply at 12:00. By convention 12 a.m. is midnight and 12 p.m. is noon. The American Heritage Dictionary, the Canadian Press Stylebook and NIST all advise writing noon or midnight instead, because the two labels are not self-evidently ordered. Source: the Wikipedia article on the 12-hour clock. The page follows that advice and puts the word in brackets at both readings, as 12:00 AM (midnight) and 12:00 PM (noon), rather than leaving the label to carry the meaning on its own. ### Which numbers are exact Every number in the conversion is a definition of a written notation, not a measurement, so none of them can be revised by a better experiment. | Number | Value | Exact? | Source | |---|---|---|---| | Hours in a day | 24 | exact by definition of the 24-hour notation | Wikipedia, "24-hour clock" | | Hours in each half of the day | 12 | exact by definition of the 12-hour notation | Wikipedia, "12-hour clock" | | Minutes in an hour | 60 | exact by definition | BIPM SI Brochure, 9th edition: the minute is 60 s and the hour is 60 min, among the non-SI units accepted for use with the SI | | Minutes in a day | 1440 | exact, being 24 times 60, and both factors are exact | follows from the two rows above | The hour and the minute are read as whole numbers, and every comparison the page makes is between whole numbers, so no answer is decided by a rounded value. ### What the converter refuses Each of these gets its own message rather than a guessed answer: an empty field; a shape the page does not read; an entry carrying seconds, such as 12:30:45; a minute above 59; a 12-hour hour outside 1 to 12, such as 13:00 PM or 0:45 AM; and a 24-hour hour above 23 that is not the 2400 form. Seconds are out of scope. The page converts a bare clock reading, so it attaches no date, no time zone and no UTC offset. ### Frequently asked questions **What is 2330 in standard time?** 11:30 PM. The hour 23 gives a remainder of 11 when divided by 12, and 23 is 12 or more, so the marker is PM. **How do you convert an afternoon time to military time?** Add 12 to the hour and keep the minutes. For 7:45 PM: 7 plus 12 is 19, so the answer is 1945. The one exception is 12 PM, which stays hour 12, because 12 mod 12 is 0. **Is midnight 0000 or 2400?** Both are used. ISO 8601 treats 00:00 as the start of a date and 24:00 as the end of it, and the two name the same instant one day apart. 00:00 is the usual choice when the reading must be unambiguous. **Is 12 PM noon or midnight?** By convention 12 p.m. is noon and 12 a.m. is midnight. Because the labels confuse people, several style guides advise writing noon or midnight instead, and this page shows the word in brackets. **Does 12:30 mean half past noon or half past midnight?** The page reads it as half past noon, because it carries no AM or PM marker and is therefore treated as 24-hour time. For half past midnight, enter 12:30 AM or 0030. **Does the converter handle seconds or time zones?** No. It converts hours and minutes only, and it attaches no date, time zone or offset. An entry with seconds is refused rather than truncated.