Please tell me how you can do it so that the 24 time zone always appears in the datetime-local, or how you can replace it or at least change the style of the given input enter image description here

just not all users understand that after the time you need to enter am, pm

  • I tried to add patern not <input type = "datetime-local" name = "ddaytime" pattern = "[0-9] {4} - [0-9] {2} - [0-9] {2} T [0 -9] {2}: [0-9] {2} "> - Sergey

3 answers 3

The answer is simple. It's impossible. If absolutely necessary, use JS.

  • if you can easily write a code or link please? - Sergey
  • This is not a bad implementation. - Vasiliy Rusin

The fact is that such a <input type="datetime-local"/> entry means that the input uses the local time format specified in the user's system.

Here the key word is local.

For my part, I see no reason to deal with this, since if the user has input from AM PM, this means that such input is familiar to the user and he is used to it.

In any case, you can use custom JavaScript component.

  • You are completely wrong. He was removed from the working draft, and moved to a draft adjustment . Simply put, he was promoted. - Vasiliy Rusin
  • @Vasiliy Rusin is possible, but for the link that I gave they say that the working code was removed from browsers. I just quoted a free translation. - Dmitry Polyanin
  • here is a draft is not worth it misleading people. Your link is a mass hysteria during the transition draft. - Vasiliy Rusin
  • @Vasiliy Rusin is good, then I delete this part - Dmitry Polyanin
  • @Vasiliy Rusin what you gave refers to datetime-local and I wrote about datetime, and in my browser, datetime really works as input just a string. - Dmitry Polyanin

I do not see any AM / PM

 <input type="datetime-local"/> 

enter image description here

  • one
    because your system has a 24-hour time zone, and for those who have a 12-hour clock, they have a different input - Sergey
  • 2
    @Sergey, And if they have a 12 hour format, how can they not know about am / pm? The question is meaningless. The browser displays the images in accordance with how preferable it is for the user. - Vasiliy Rusin
  • @VasiliyRusin I understand everything perfectly, but still I would like to change it to make the form look the same for everyone - Sergey
  • one
    @Sergey, precisely because of such desires, there is absolutely no way to make the display of a standard field customizable . If you need to move away from the specification, use the custom implementation on JS. - Vasiliy Rusin