Displaying 2 results from an estimated 2 matches for "past_dates".
2009 Oct 28
1
Generating sequence of dates
...rent,by='1 week',length=53)
Question: How to generate a sequence of past dates starting one week in the past relative to the current date. Obviously, what I wrote below is not correct. I think I can write a for loop and push each value into a vector. Is this the best way? Thanks.
Satish
past_dates = seq(current,by=-'1 week',length=156)
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?