i have four dates:
First two are the beginning and end of a month
start_m = Time.new(2010,1).beginning_of_month
end_m = Time.new(2010,1).end_of_month
and the last two, d1 and d2, with d1 <= d2
What i want is an array containing the day numbers that come from the intersection of start_m -> end_m and d1->d2
for example:
start_m = 2011-01-01
end_m = 2011-01-31
d1 = 2010-12-20
d2 = 2011-01-11
the result would be
[1,2,3 ... 11]
is there an easy approach to do this intersection?
See documentation for Array#& . Output: