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.commercial([cwyear=-4712[, cweek=1[, cwday=1[, start=Date::ITALY]]]]) → date
Creates a date object denoting the given week date.

The week and the day of week should be a negative 
or a positive number (as a relative week/day from the end of year/week when negative). 
They should not be zero.

```

For the interval

```
require 'date'

  def week_dates( week_num )
    year = Time.now.year
    week_start = Date.commercial( year, week_num, 1 )
    week_end = Date.commercial( year, week_num, 7 )
    week_start.strftime( "%m/%d/%y" ) + ' - ' + week_end.strftime("%m/%d/%y" )
  end

  puts week_dates(22)

```

> 
> EG: Input (Week Number): 22
> 
> 
> Output: 06/12/08 - 06/19/08
> 
> 
> 

credit: Siep Korteling <http://www.ruby-forum.com/topic/125140>