From: Sky Yin Date: 2006-01-25T04:05:36+09:00 Subject: Re: split up days Range can help you. Example: >>require 'date' >>days = (Date.new(2006,1,20)..Date.new(2006,1,24)).to_a >>days.each {|date| puts date} =>2006-01-20 =>2006-01-21 =>2006-01-22 =>2006-01-23 =>2006-01-24 :^) On 1/24/06, misiek wrote: > Robert Klemme wrote: > > misiek wrote: > > > >>hi > >> > >>problem is .... > >> > >>I got date @start and date @stop as a date and I can display like > >> > >>@start = Thu Jan 19 00:00:00 CST 2006 > >>@stop = Tue Jan 21 00:00:00 CST 2006 > > > > > > This is not valid Ruby code. What types are these objects? > > > > > >>how to split up this days and put to array ? > >> > >>array[] = "Thu Jan 19 00:00:00 CST 2006 > >>Wed Jan 20 00:00:00 CST 2006 > >>Tue Jan 21 00:00:00 CST 2006" > > > > > > You assign a string but you seem to want an array. Also, you don't seem > > to want to split but to append. > > > > # split at whitespace > > array = @start.to_s.split /\s+/ > > > > # split into array, works for Time > > array = @start.to_a > > > > # put into array > > array = [@start, @stop] > > > > # concatenate > > array = "#{@start}\n#{@stop}" > > > > > >>is there some function which can do that ? > > > > > > If you tells us what you actually want, we might be able to come up with > > an answer. > > > > Cheers > > > > robert > > > > > thank you for answer . > from FORM I can select days, FROM - TO > like from Monday to Friday > exanmple: > > from 2006-01-20 to 2006-01-24 > > and than I need to put each day to database as five days like > > 2006-01-20 > 2006-01-21 > 2006-01-22 > 2006-01-23 > 2006-01-24 > > so first I need to put each day to array and that in loop put each day > to database. > > this is what I want > thanks for help > > -- Blog >>> http://spaces.msn.com/members/skyincookoo