I also have a week number, extracted from another time object like this
other_time.strftime('%W').to_i
%W gives:
Week number of the year. The week starts with Monday. (00..53)
I also have a day name:
'Tuesday'
How can I build a DateTime object that represents Tuesday in the week indicated by the week number? The time component of the object is irrelevant at this stage, as it will be changed in a later step.
I’m using Rails 3.2.0 and Ruby 1.9.2p320.
Edit: Incorrectly stated that I wanted a Time object. I actually want a DateTime object.
You can check the day against your desired day, and adjust accordingly. It’s not great, but it does work.