Convert 12h/24h time

Change a clock time between AM/PM notation and the 00:00–23:59 system.

freeworks offlinenothing uploaded
Tool12h/24h Time Converter
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

For AM/PM input, 12 is reduced modulo 12 and another 12 hours are added only for PM. In the opposite direction, hour zero becomes 12 AM, hours above 12 subtract 12 and receive PM, and minutes and supplied seconds are retained.

  • Seconds appear only when the source includes them, avoiding invented precision.
  • A colon before minutes and an AM or PM suffix are required for 12-hour input.

Worked example

12h to 24h
Convert 2:30 PM to 24-hour format
Input
											2:30 PM
										
Output
												24h: 14:30
12h: 2:30 PM
											

When to use this

Transport timetables change 18:45 to an AM/PM display, calendar imports normalize 7:05 PM to 19:05, and shift rotas disambiguate noon and midnight.

Edge cases

  • 12:00 AM maps to 00:00 rather than 12:00.
  • 12:00 PM remains 12:00 rather than becoming 24:00.
  • 24:00 is rejected because the accepted clock-hour range is 00 through 23, not ISO’s special end-of-day notation.

References