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
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
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
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 arrayregards
Date supports iteration:
startDate = Date.parse(‘2000/05/05’)
days = []
startDate.upto(Date.today){|day| days << day}
cheers
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs