Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get an "am" or "pm" indicator to display with the HTML5 time input element?

When I add the HTML5 time input element, it shows me:

__:__:__

It seems to be in a 24-hour (military/european) hour mode. How can I get it to append an "am/pm" indicator (and, as I noted in a prior question, I don't need/want the seconds portion, either)?

like image 842
B. Clay Shannon-B. Crow Raven Avatar asked Aug 24 '15 14:08

B. Clay Shannon-B. Crow Raven


1 Answers

Possible duplicates : html5 time inputs shows 12 hours and HTML5 changing <input type="time"> to 24hrs. format? it is possible

Seems like some people are stuck with 24 hours and others 12 hours with AM/PM. Here's what I found out. For me, I was stuck on a 24 hour mode and changing the Operating system's date format didn't work for me (at least not right away probably due to chrome previously installed). So I went in google chrome's settings -> Show Advanced Settings -> Languages -> Language and input settings... Then I switched to English (United States), restart Chrome and Voilà, 12 hour mode selection and able to select AM or PM. So it is probably designed so you don't have to worry about it and that it will be displayed to the user's date/time format preferences. I do not think it is possible AT THE MOMENT to force how it will render as described in this answer Is there any way to change input type="date" format?.

The format displayed by the user interface control and accepted as user input. Browser vendors are encouraged to follow the user's preferences selection. For example, on Mac OS with the region "United States" selected in the Language & Text preferences pane, Chrome 20 uses the format "m/d/yy".

like image 62
user627283 Avatar answered Nov 03 '22 22:11

user627283