Maybe this is also a goood way :)

With this you can get the weeknumber of a date like

Time.now.kw => 11

or just create the starttime of a week(starting on monday -> for sundy set wd to Zero)

t = Time.newkw(21) => Mon May 23 01:00:00 +0200 2011



# Fgt der Timeklasse Kalenderwochen beginnend bei Montag ein.
class Time
    def kw(wd=1)
        kw = self.strftime("%U").to_i
        kw -= 1 if self.wday < (wd%7)
        return kw
    end
    def self.newkw(kw=0, year=Time.now.year.to_i, wd=1)
        # Gibt Timeobjekt zurck, welches den Start der KW ausgibt
        t = Time.local(year)
        (0..364).each { |n|
            if t.kw(wd) == kw; break; end
            t += 3600*24
        }
        return t
    end
end


puts "\n\n\nDie Kalenderwoche " + Time.now.kw.to_s + " beginnt " +
Time.newkw(Time.now.kw).to_s
puts "Test: Time.newkw(" + Time.now.kw.to_s + ").kw.to_s = " +
Time.newkw(Time.now.kw).kw.to_s

terminstart = Time.local(2011,05,23,11)
terminende = Time.local(2011,05,23,13,30)

puts "\n\nDer Termin ist in der KW " + terminstart.kw.to_s + " beginnt "
+ terminstart.to_s + " und endet " + terminende.to_s