From: Marc Heiler Date: 2008-08-06T20:30:44+09:00 Subject: Re: Get Previous month Shadowfirebird wrote: > Hi, > > thistimelastmonth = Date.today << 1 > lastmonth = thistimelastmonth.month > answer = Date::MONTHNAMES[month] > > I wouldn't recommend that you use those variable names, but hopefully > you get the idea. > > > On Wed, Aug 6, 2008 at 9:30 AM, Pragash Mr. Your example looks cool :) I took the liberty to change it to a one liner. Date::MONTHNAMES[(Date.today << 1).month] # => "July" -- Posted via http://www.ruby-forum.com/.