Reputation: 3
i m using html5 time attribute ; like this
<input type="time" class="inputDateFromTo" id="time" />
it is showing time in 24 hrs format ; but i want it in 12 hrs format with am/pm, ex "4.30 PM"
please suggest me the code using simple javascript or pattern attribute
Upvotes: 0
Views: 214
Reputation: 66394
You can make one yourself using something like the following
<input type="text" required placeholder="hh:mm" pattern="\d\d?:\d\d" />
<select>
<option selected value="am">AM</option>
<option value="pm">PM</option>
</select>
Upvotes: 0
Reputation: 22741
You can use input type as type="datetime-local"
<input type="datetime-local" class="inputDateFromTo" id="time">
Upvotes: 1