Change the hour format to 24 in HTML


How can I change the format of input type="time" to 24 hours?

I searched for the HTML5 tags but there is no one that I need.

asked by Jose Luis GP 16.03.2017 в 16:08

1 answer


As easy as this (⚠ if you have the computer in 24h format and use Chrome):

<input type="time"/>

Note: It is very new and is not supported even in Firefox or versions of Internet Explorer and Edge

Or you can use external libraries like TimePicker.js:

var timepicker = new TimePicker('time', {
  lang: 'en',
  theme: 'blue-grey'
timepicker.on('change', function(evt) {
  var value = (evt.hour || '00') + ':' + (evt.minute || '00');
  evt.element.value = value;

<script src=""></script>
<link href="" rel="stylesheet"/>

  <input type="text" id="time" placeholder="Horas:Minutos">

You have events like:

timepicker.on('open', function(evt){


timepicker.on('close', function(evt){

answered by 16.03.2017 / 16:14