开发者

Rails 3 week display

How Can i display the remai开发者_StackOverflow中文版ning weeks of the year in rails?


You don't really specify a format here obviously, but something like this will show you the index of every week left in the year:

(Date.today.cweek..52).each { |w| puts w }

See Looping through weeks of the year in Ruby (Sinatra) for a similar question


(Date.today.cweek...Date.today.end_of_year.cweek)

EDIT

(Date.today.cweek...Date.today.end_of_year.cweek).each_slice(2) do |weeks|
  puts weeks.join("-")
end
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜