What this calculator does
Convert between 24-hour military time and 12-hour time with AM or PM.
How it works
The calculator evaluates 24-hour time uses hours 00–23; for PM add 12 except at 12 PM, and map 12 AM to 00. Inputs are checked before calculation, and invalid values such as zero denominators or out-of-range selections produce a clear error instead of a misleading result.
Input query strings and outputs
Use an input name in this page’s URL as ?name=value, and join additional inputs with &. Portable shared links may instead use the compact ?ac= state parameter.
Input query strings
5-
?mode=ConversionChoice · Required · Default: to12 · Accepted values: to12, to24
-
?time24=24-hour timeTime · Required · Default: 14:30
-
?hour12=12-hour hourNumber · Required · Default: 2
-
?minute12=MinuteNumber · Required · Default: 30
-
?meridiem=AM or PMChoice · Required · Default: PM · Accepted values: AM, PM
Outputs
2-
resultConverted timeText · Primary output
-
hoursAfterMidnightHours after midnightNumber
Inputs and results
The inputs are Conversion, 24-hour time, 12-hour hour, Minute, AM or PM. Results include Converted time, Hours after midnight.