display AM/PM format in time_select tag in rails
I am using
<%= f.time_select :time_from , :minute_step => 15 %>
to display time select option with a step of 15 mins.
Its showing 24hours clock. I want to show 12hour clock in display section (use开发者_运维百科r view) and 24hour clock in value section (for back ground processing.).
Here is 12 hour plugin for this.
http://code.google.com/p/rails-twelve-hour-time-plugin/
The plug-in is pretty old. For Rails 3, see https://gist.github.com/1340125. Rails 3.1 has a built-in option.
You can add am and pm to your time by putting this
<%= f.time_select :time, {ampm: true},placeholder: "Pickup time"%>
精彩评论