I can not for the life of me find where to add seconds to an input box for datetime-local
Right now it asks for M-D-Y H:M A/P
, I want to add :S
to the H:M
part. The result would be: M-D-Y H:M:S A/P
I'm coding with PHP / HTML5
Any direction would be greatly appreciated.
Add step="1" as one of the attributes on the input element. This defines the seconds field as being allowed to step by the specified amount when the up and down arrows are clicked and also shows the seconds field. Further definition of the datetime-local input element can be seen here. http://dev.w3.org/html5/markup/input.datetime-local.html
<input type="datetime-local" step="1" name="time">
The step attribute takes arguments of integers or floating point numbers (decimals) to display milliseconds as well. I haven't testing many permutations of this but it does work on a cursory try and it looks like the decimal places provided define how much of the milliseconds portion of the time can be adjusted. .1 translates to .100, .200, .300 etc. and .001 would translate to .001, .002, .003 etc.
<input type="datetime-local" step=".1" name="time">
Working jsFiddle version as well. http://jsfiddle.net/x2azB/
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With