I was playing time arithmetic in rails console. I have subtracted two different times and got back a long number, please see below my code.

a = User.find(1).updated_at   # returns   Mon, 03 Mar 2014 11:07:43 UTC +00:00
b = User.find(1).created_at   # returns   Mon, 03 Mar 2014 08:36:50 UTC +00:00 

a - b                         # returns   9053.699814796448 

My question is. What is this number 9053.699814796448? Is it time? What is it's unit? and how is that calculated? Is it possible to change the default unit of the outcome?

Thanks

有帮助吗?

解决方案

a - b gives you the time in seconds. Check out the Time#- .

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top