> Another way to compute timeslots which avoids this might be: > > timeslots = (0..6*24).map {|h| first + h.hour} > > Generalizing this to arbitray start and end times is left as an > exercise to the reader. Maybe this ? so you represent day segments start_time = Time.gm(2006, 10, 31, 0, 0, 0) slots = 3 no_of_days = 3 schedule =[] timeslots = (0..slots).map{|h| start_time + h.hour} timeslots.each do |timeslot| (0..no_of_days).map do |i| schedule << timeslot+i.day end end puts schedule Tony