Something like:

Date.today.beginning_of_month

Date.today.ago(1.month).beginning_of_month

Probably an easier way, just off the top of my head.

Jamey


On Wed, Nov 3, 2010 at 9:43 AM, Vitaliy Yanchuk <[email protected]>wrote:

> Hello everyone.
>
> Please advice how to get todays month first day and previous month first
> day.
>
> If go on by this post date, it will need to  give me now
> 01-11-2010
> and
> 01-10-2010
>
> or if today was like 3 Jan 2010 it would be
> 01-01-2010
> and
> 01-12-2009
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to