Search code examples
htmlinputtimeformat

HTML5 input type time setting values not working


I have a form with input type time. I am trying to set values. But it is not showing. Here is my code.

<input type="time" name="exit" id="teacher-entry-exit-form-exit-input" class="form-control" value="08:56 AM" required="">

What am I doing wrong?


Solution

  • It's based on 24-hour time, therefore use value="08:56" for AM and value="20:56" for PM.

    Example Here

    <input type="time" value="08:56">
    

    See: http://www.w3.org/TR/html-markup/input.time.html