2619 2619 - 7 months ago 41
HTML Question

html5 time inputs shows 12 hours

I am using html 5 input element with

type=time
. The problem is it shows time with
12 hours
but I want it to show it in
24 hours
a day. How can I make it to 24 hours? Here is my input field

<input type="time" name="time" placeholder="hrs:mins" pattern="^([0-1]?[0-9]|2[0-4]):([0-5][0-9])(:[0-5][0-9])?$" class="inputs time" required>


DEMO

Here is jsfiddle

Answer

HTML5 Time Input

This one is the simplest of the date/time related types, allowing the user to select a time on a 24 hour clock, no AM or PM. The value returned is hours:minutes which will look something like 14:30.

<input type="time" name="time" />

This feature is still in draft. Each browser shows it differently.

- Opera (Presto Engine) shows it the right way.
- Chrome (Webkit Engine) shows it in AM/PM.
- Firefox (Gecko Engine) doesn't show anything, but validates.

Not a good idea to use!

Comments