Rails 3:带有 am/pm 选项的 datetime_select [英] Rails 3: datetime_select with am/pm options

查看:46
本文介绍了Rails 3:带有 am/pm 选项的 datetime_select的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Rails 3 中,有没有办法使用 datetime_select 并显示小时数,显示 12 小时 am/pm 选项而不是 24 小时选项?

In Rails 3, is there a way to use datetime_select and display hours showing 12 hour am/pm options rather than 24-hour options?

推荐答案

如果有人偶然发现这个问题,rails 3.2 的答案是:

In case anyone stumbles upon this question, the answer for rails 3.2 is:

<%= f.datetime_select :attribute_name,  
                       ampm: true %>  

这篇关于Rails 3:带有 am/pm 选项的 datetime_select的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆