|
|
1
1
这可以帮助您: http://www.francisfish.com/getting_the_number_of_months_between_two_dates_in_rubyrails.htm 获取月数后,您可以从此处获取月名: months = ["", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] months[start_date.month, number_of_months]
如
编辑:
Date::MONTHNAMES[start_date.month, number_of_months]
编辑:
Date::MONTHNAMES[start_month_num, end_month_num] 但是,如果end-month-num小于start-month-num,这将失败。 这应该有效: if start_month <= end_month Date::MONTHNAMES[start_month..end_month] else Date::MONTHNAMES[end_month..12] + Date::MONTHNAMES[1..start_month] end |
|
cluster1 · 采取独立的新行动的好处是什么? 10 月前 |
|
|
Robert · 使用JSON或哈希时,将NULL替换为NIL 10 月前 |
|
|
Fred Willmore · Rails控制器不呈现任何模板 1 年前 |
|
|
Diogo Amaral · 实现API请求的正确方式 1 年前 |
|
|
Meknassih · 在控制器方法中分配给模型没有任何作用 1 年前 |
|
|
Michael Ding · Rails上的默认会话到期问题 1 年前 |
|
|
Flávio · 基于另外两个生成数组 1 年前 |