You can also do
Time.now.year - other_date.year
Cheers,
-Roy
-Original Message-
From: rubyonrails-talk@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of
gsterndale
Sent: Thursday, November 20, 2008 11:26 PM
To: Ruby on Rails: Talk
Subject: [Rails] Re: Getting the number
I've done so in the past with the Time class.
((Time.now-past_date)/1.year).round
On Nov 20, 10:42 pm, James Englert [EMAIL PROTECTED] wrote:
Hey,
I need to get the number of years (as a number) between two dates. Here is
what I have as a helper.
# Returns the number of years between
2 matches
Mail list logo