Question

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

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top