Please share if there any such easy methods in rails. I have dates like date1 = Date.today date2 = Date.today - 3.months (Example can be anything) Now how to get month difference as 3 (date1 - date2) Thanks for any help Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Michael Pavling
2010-Jun-24 13:17 UTC
Re: calculate the number of months difference between two dates
On 24 June 2010 13:29, Tom Mac <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Now how to get month difference as 3 (date1 - date2)Googling for "ruby months between two dates" gleans this as the first result: http://www.francisfish.com/getting_the_number_of_months_between_two_dates_in_rubyrails.htm ...and loads of other likely candidates. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.