How to get week of the month

Hi,

I want to display week of a particular month like for 10th August 2011,
should get week of the month as 2.

Thanks in advance.
Sulabha

···

--
Posted via http://www.ruby-forum.com/.

hi Sulabha -

  it seems you really just need the integer that represents the day from
the date... convert that to a float (with #to_f) and then divide it by
7.0, then call #ceil on the result (which will round it up...)

- j

···

--
Posted via http://www.ruby-forum.com/.

How are you defining "week of the month"?

What week is e.g. 5th September 2011 ? Is that 1 or 2 ?

···

On Wed, Aug 3, 2011 at 12:14 PM, sulabha w. <sulupw@gmail.com> wrote:

I want to display week of a particular month like for 10th August 2011,
should get week of the month as 2.

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

twitter: @hassan