Ruby on Rails 时间加上N天
来源:互联网 发布:nginx 缓存静态文件 编辑:程序博客网 时间:2024/05/21 09:44
问题:在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.secondDate.today + n.minutes # you can use 1.minuteDate.today + n.hours # you can use 1.hourDate.today + n.days # you can use 1.dayDate.today + n.weeks # you can use 1.weekDate.today + n.months # you can use 1.monthDate.today + n.years # you can use 1.year
0 0
- Ruby on Rails 时间加上N天
- Ruby & Rails on Rails 進階書單
- ruby and ruby on rails
- install Ruby on Rails
- Ruby on Rails 实践
- Ruby on Rails!
- Ruby on Rails
- 关于Ruby on Rails
- 初探Ruby on rails
- Ruby on Rails
- 了解Ruby on Rails
- Ruby on Rails 是什么?
- 什么是Ruby on Rails
- Ruby on Rails 实践
- Ruby on Rails
- 实践ruby on rails
- Ruby On Rails小结
- Hello Ruby on Rails
- 切片数据下载
- void及void指针含义的深刻解析
- Counting bobs
- oracle basic compress
- Object -C 2.0基础语法
- Ruby on Rails 时间加上N天
- 求n个数中第k大的数、前K大的数、快速排序
- NGUI 鼠标停留UI上时缓慢显示子Item,当无停留超过一定时间后回到原地
- AJax和comet
- Java HashMap的工作原理
- android-Activity操作Data文件
- tabbar 按钮形状自定义显示问题
- 关于Binary Search的写法总结
- maven教程(一)配置环境