Ruby on Rails Thursday, September 26, 2013

unit.created_at.class
 => ActiveSupport::TimeWithZone 

 Time.zone.now.class
 => ActiveSupport::TimeWithZone 


 Time.zone.now - unit.created_at
 => 47709736.32316899 

I think that's the number of seconds that have passed between when the unit was created and the current time. Is this correct? If so, is there any easier way to find the total months that passed between two time objects like this?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ee22138c-7949-4ebb-b1d6-1776362c4f99%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment