0

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

  • Not an exact duplicate - but all the information you need is in this post: http://stackoverflow.com/questions/13523060/html5-time-inputs-shows-12-hours – Lix Jun 12 '14 at 11:24

2 Answers2

1

You can use input type as type="datetime-local"

 <input type="datetime-local" class="inputDateFromTo" id="time">
Krish R
  • 22,583
  • 7
  • 50
  • 59
0

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>
Paul S.
  • 64,864
  • 9
  • 122
  • 138