'Input type time 24 hour format
Too many this type of old questions are already in Stack Overflow, but now I would like to know any new method to fix this problem!
<input type="time">
How can we change this 12hr to 24hr format for all browsers? It would be great this will work with only JavaScript and without any third party JS/Jquery. Can any one help?
Referenced questions:
Solution 1:[1]
From documentation:
The value of the time input is always in 24-hour format: "hh:mm", regardless of the input format, which is likely to be selected based on the user's locale (or by the user agent).
So you need to change locale to get in 24hrs format.
That came to mind when I opened your same question on 2 different laptops. One is showing 24hrs format and other is showing 12hrs format.
You need to set locale in your project which has 24hrs format.
Example: 'ja-JP'
, 'en-GB'
has 24hrs format
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Vikasdeep Singh |