Iterative question


#1

hi all
how to do a iterative for Time object,
i.e.
i wanna iterative from 2000/05/05 to now, output to a array

regards


#2

joe wrote:

how to do a iterative for Time object,
i.e.
i wanna iterative from 2000/05/05 to now, output to a array

(time_a…time_b).to_a

Daniel


#3

joe wrote:

hi all
how to do a iterative for Time object,
i.e.
i wanna iterative from 2000/05/05 to now, output to a array

regards

Date supports iteration:

startDate = Date.parse(‘2000/05/05’)
days = []
startDate.upto(Date.today){|day| days << day}

cheers