문제

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