牌語備忘録 -pygo

あくまでもメモです。なるべくオフィシャルの情報を参照してください。

牌語備忘録 -pygo

Rails での時間・時刻の操作メモ

irb(main):001:0> Time.now
=> 2012-08-10 16:30:31 +0900
irb(main):002:0> Time.now.change :year => 2019
=> 2019-08-10 16:30:52 +0900
irb(main):003:0> 2.weeks.ago
=> Fri, 27 Jul 2012 07:31:42 UTC +00:00
irb(main):004:0> Date.today
=> Fri, 10 Aug 2012
irb(main):005:0> Time.now.advance(:years => 1, :months => 3)
=> 2013-11-10 16:33:16 +0900
irb(main):007:0> 1.seconds
=> 1 second
irb(main):009:0> 1.hours
=> 3600 seconds
irb(main):010:0> 1.month
=> 1 month
irb(main):011:0> 1.year
=> 1 year
irb(main):012:0> 2.weeks.since
=> Fri, 24 Aug 2012 07:43:24 UTC +00:00