Summary -

In this topic, we described about the Time Input type with detailed example.

The time input type used for entering a time (hours and minutes). Browser may use 12 or 24-hour format for entering times, based on local system's time setting.

Syntax -

<input type="time" id="exit-time">

Example -

Below example explains the enrolling a time.
<!DOCTYPE html>
<html lang="en">
  <head>
       <title>HTML5 Time Input Type</title>
        <script>
           function getValue() { 
           var time = document.getElementById("mytime").value;
           alert(time); 
          }
        </script>
   </head>
   <body>
      <form>
      <label for="mytime">Choose Time:</label>
      <input type="time" id="mytime">
      <button type="button" onclick="getValue();">Get Value</button>
       </form>
    </body> 
</html>   

Output-

Warning! The input type="month" is not backed by Safari, Firefox, and Internet Explorer browsers. Presently supported in Edge, Chrome, and Opera browsers.
Browser Support

The following browsers and corresponding versions in the table that comple tely supports the time type.

Input Type Chrome Edge Firefox Safari Opera
Type=”time” 20.0 12.0 57.0 Not Supported 10.1