Time input (type="time")

HTML Living Standard

Collect a time without a date or time zone. Its value uses 24-hour time regardless of how it is shown.

On this page

Attributes and behavior

Value or syntaxWhat it does
value="09:30"The machine-readable default value, independent of the visual format.
min / maxSets the lowest and highest permitted values.
requiredAn empty field prevents a normal validated submission.
stepControls the allowed increment in seconds. The default is 60 seconds.

Try the example

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Time input</title>
  <style>
form { display: grid; gap: 12px; justify-items: start; } output { display: block; margin-top: 10px; }
  </style>
</head>
<body>
<form id="demo">
  <label>Choose a value <input name="selection" type="time" value="09:30" min="09:00" max="18:00" required></label>
  <button type="submit">Check</button>
</form>
<output id="response"></output>
  <script>
const form = document.querySelector('#demo');
form.addEventListener('click', event => {
  const submitter = event.target.closest('[type="submit"], [type="image"]');
  if (!submitter) return;
  event.preventDefault();
  if (!form.noValidate && !submitter.formNoValidate && !form.reportValidity()) return;
  const values = new FormData(form, submitter);
  document.querySelector('#response').textContent =
    'Passed validation. Fields received: ' + [...values.keys()].join(', ');
});
  </script>
</body>
</html>

What to expect Picker appearance varies by browser and device. Submit a value in range to see the validation result.

Official references