Question: I would like to know how to get the current week number from Rails and how do I manipulate it: 

1. Translate the week number into date.
2. Make an interval based on week number.

Thanks.

Answer: 
Use [`strftime`](http://www.ruby-doc.org/core-1.9.3/Time.html#method-i-strftime):

> 
> `%U` - Week number of the year. The week starts with Sunday. (00..53)  
> 
> `%W` - Week number of the year. The week starts with Monday. (00..53)
> 
> 
> 

```
Time.now.strftime("%U").to_i # 43

# Or...

Date.today.strftime("%U").to_i # 43

```

If you want to *add* 43 weeks (or days,years,minutes, etc...) to a date, you can use [`43.weeks`](http://as.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Numeric/Time.html#M000324), provided by ActiveSupport:

```
irb(main):001:0> 43.weeks
=> 301 days

irb(main):002:0> Date.today + 43.weeks
=> Thu, 22 Aug 2013

irb(main):003:0> Date.today + 10.days
=> Sun, 04 Nov 2012

irb(main):004:0> Date.today + 1.years # or 1.year
=> Fri, 25 Oct 2013

irb(main):005:0> Date.today + 5.months
=> Mon, 25 Mar 2013

```
[`Date#cweek`](http://ruby-doc.org/stdlib-2.2.2/libdoc/date/rdoc/Date.html#method-i-cweek) seems to get the ISO-8601 week number (a Monday-based week) like `%V` in strftime (mentioned by @Robban in a comment).

For example, the Monday and the Sunday of the week I'm writing this:

```
[ Date.new(2015, 7, 13), Date.new(2015, 7, 19) ].map { |date|
  date.strftime("U: %U - W: %W - V: %V - cweek: #{date.cweek}")
}

# => ["U: 28 - W: 28 - V: 29 - cweek: 29", "U: 29 - W: 28 - V: 29 - cweek: 29"]

```