2

I am using datetime picker from Html5.

      <input id="datetime"  type="datetime-local">

But It is containing 12 Hrs time with A.M or P.M, But I want to set 24 hrs place of A.M, P.M.

I am refering this link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local

My problem is only I want to set 24 hrs in time.

Varun Sharma
  • 4,632
  • 13
  • 49
  • 103
  • Am I missing something or it is `24hrs` format and not 12hr in the code snippet. – Expressingx Feb 20 '18 at 08:45
  • @Denisx It is 24 hrs format. Please run my snippet then you will get clear. I don't want to AM PM format, I want only 00 to 24 hrs – Varun Sharma Feb 20 '18 at 08:46
  • Take a look: https://stackoverflow.com/questions/13523060/html5-time-inputs-shows-12-hours/13523302 – void Feb 20 '18 at 08:48
  • @void I already looked. It is only for time. Not for date and time. And also it is setting AM PM. Against I don't want to AM PM – Varun Sharma Feb 20 '18 at 08:49
  • @VSH that is why I am not marking it duplicate, but is one and the same thing. – void Feb 20 '18 at 08:50
  • @void thanks. Both are viseversa. It is not duplicate. – Varun Sharma Feb 20 '18 at 08:51
  • The date picker format is set by the browser. Different user agents has different formats. – SG_Rowin Feb 20 '18 at 09:09
  • Possible duplicate of [how can I use datetime-local without AM/PM?](https://stackoverflow.com/questions/22332520/how-can-i-use-datetime-local-without-am-pm) – Sully Mar 11 '18 at 12:55
  • The short answer is you cannot as it is only implementing ISO 8601 date format. Use JQuery Datapicker for more flexibility https://jqueryui.com/datepicker/ – Sully Mar 11 '18 at 12:58

1 Answers1

1

You can use input type="time" but It depends on the time format of the user's operating system when the web browser was launched. You can change your OS time format and restart your browser to check.

This doesn't support all browser, if you are working with bootstrap is better to use http://jdewit.github.io/bootstrap-timepicker/

Mahdi Salah
  • 189
  • 2
  • 11