开发者

Rails, for each second in past week

I want to do something for each second in the past week and pass in the current epoch time as well... I'm not sure how to do this, but it seems really trivial, here is my pse开发者_Go百科udo code:

1.week.ago..Time.now do |second|
  puts second
end

How would I make this output the current time in ints for each second in that range?


How about

(1.week.ago.to_i..Time.now.to_i).each{ |second| puts "second=#{second}"}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜