What does a valid time look like?

A time of day is written as hours and minutes joined by a colon, HH:MM, sometimes with seconds as well, HH:MM:SS. Most of the world, and most computers, use the 24-hour clock, which runs from 00:00 at midnight to 23:59. The 12-hour clock, common in the United States and some other English-speaking countries, counts the hours from 1 to 12 twice a day and adds AM before noon and PM after it, so 2:30 PM is 14:30.

You check a time when a form, a calendar import or a spreadsheet rejects one, or when you build a booking form, a timetable or a list of opening hours that should accept times in a set format.

Tool description

Type or paste a time into the Time field, and the result shows as you type: "Time is valid" or "Time is not valid". Spaces and line breaks around the time are ignored.

The Hour format menu starts on 24-hour, which accepts hours from 0 to 23. 12-hour (AM/PM) accepts hours from 1 to 12, followed by a space and AM or PM.

The Seconds menu starts on Without seconds, so 14:30 passes and 14:30:15 fails. With seconds turns that around, and Seconds optional accepts both.

What passes and what fails

  • Hours with one or two digits: 9:05 and 09:05 both pass. Minutes and seconds always need two digits, so 9:5 fails.
  • In the 24-hour format, everything from 00:00 to 23:59 passes. 24:00 fails, although some timetables use it for midnight at the end of a day.
  • In the 12-hour format, 9:05 AM, 02:30 PM, 12:00 AM (midnight) and 12:00 PM (noon) pass, while 0:30 AM and 13:00 PM fail.
  • AM and PM must be capital letters after exactly one space: 2:30PM, 2:30 pm and 2:30 p.m. fail. In the 24-hour format, a time with AM or PM fails, and in the 12-hour format, a time without them does.
  • A colon is the only separator: 14.30, 14h30 and 1430 fail.
  • Seconds stop at 59 and have no fractions: 23:59:60 and 14:30:15.5 fail.
  • A time zone after the time fails, as in 14:30Z or 14:30 UTC.

Good to know

  • The check looks at the time alone. It can't know that a time such as 2:30 may be skipped on the night the clocks move forward for daylight saving time.
  • To check dates, use the Date Validator. To work out how long it is from one time to another, use the Time Duration Calculator.

Features

  • 24-hour and 12-hour times with AM or PM
  • Seconds required, optional or not allowed
  • Hours with or without a leading zero
  • Results as you type, with no button to press
  • Runs in your browser, so nothing you type is sent anywhere