问题:在RoR中需要在某个时间上添加N天,或者N小时
解决方案:
自: http://stackoverflow.com/questions/4654457/how-to-add-10-days-to-current-time-in-rails
Time.now + 10.days
或
10.days.from_now
自:http://stackoverflow.com/questions/1356457/is-there-an-add-days-in-ruby-datetime
Date.today + n.seconds # you can use 1.second
Date.today + n.minutes # you can use 1.minute
Date.today + n.hours # you can use 1.hour
Date.today + n.days # you can use 1.day
Date.today + n.weeks # you can use 1.week
Date.today + n.months # you can use 1.month
Date.today + n.years # you can use 1.year