|
|
|
|
|
by bodhi
5975 days ago
|
|
irb(main):033:0> 20.years
=> 20 years # ??????
irb(main):030:0> 20.years.to_i
=> 631152000 # number of seconds in 20 years
irb(main):026:0> 20.years.from_now
=> Sun Feb 10 10:14:11 +1100 2030 # AEDT
irb(main):027:0> 20.years.from_now.utc
=> Sat Feb 09 23:14:14 UTC 2030 # UTC/GMT
Ruby Time instances have a timezone, calling Time#utc returns the instance time converted from localtime -- or whatever timezone it is -- to UTC or Greenwich Mean Time. You are correct in that it shouldn't matter which one you use in this situation though. |
|
http://api.rubyonrails.org/classes/ActiveSupport/Duration.ht...