Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 724
odbhut.shei.chhele Avatar asked Sep 14 '14 03:09

odbhut.shei.chhele


People also ask

How do you set a 24-hour time in HTML?

To create the time control using HTML, we have <input type=”time”> tag, where time value can be used in TYPE attribute of <input> tag. By default, time control will display the output in 24 hr format.

How do you do 24-hour time input?

input type="time" The value of the time input type is commonly in 24-hour format ("hh:mm"). If the time includes seconds the format is always "hh:mm:ss". If you want the users to mention also seconds, you can do it with the help of the step attribute.

How do I restrict past dates in HTML?

the previous dates we need to set the minDate property of the date picker. if we set minDate:0 then it will disable all the previous dates. and we set input attribute min:current_date then it will disable all the previous dates.


1 Answers

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

like image 150
Josh Crozier Avatar answered Nov 05 '22 01:11

Josh Crozier