Displaying 1 result from an estimated 1 matches for "last_monday".
2008 Nov 21
5
Getting the number of years between two dates
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 now and the specified date.
def years_ago(date)
dateDifference = DateTime.now - date
results =Date.day_fraction_to_time(dateDifference)
return results[0] / 24 / 365;
end
I''m sure there is a better way to do this. What is it?