Forum: Ruby on Rails .ago

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Sijo k. (Guest)
on 2009-03-28 09:14
Hi
   I have
     m = 1.year.ago.mon      #This I get 3

     But how to get name of month ie  March from above?

Thanks in advance
Sijo
Billy H. (Guest)
on 2009-03-28 10:35
(Received via mailing list)
m = 1.years.ago.strftime("%b") #=> Mar
m = 1.years.ago.strftime("%B") #=> March

On Sat, Mar 28, 2009 at 3:14 PM, Sijo Kg
<removed_email_address@domain.invalid>wrote:

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


--
[73, 32, 108, 111, 118, 101, 32, 121, 111, 117, 32, 115, 111, 32, 109,
117,
99, 104, 33].map{|c| c.chr}.join

Only two surfaces of a box:
http://blog.pixnet.net/zusocfc
Sijo k. (Guest)
on 2009-03-28 13:34
Hi
    This is a question related to above I tried
%w(1.year.ago.strftime("%b") 11.month.ago.strftime("%b"))
      I expected ["Mar","Apr"]
      But did not work.Could you please correct it?

Sijo
Colin L. (Guest)
on 2009-03-28 13:53
(Received via mailing list)
2009/3/28 Sijo Kg <removed_email_address@domain.invalid>

>
> Hi
>    This is a question related to above I tried
> %w(1.year.ago.strftime("%b") 11.month.ago.strftime("%b"))
>      I expected ["Mar","Apr"]
>      But did not work.Could you please correct it?
>
>
[1.year.ago.strftime("%b"),11.month.ago.strftime("%b")]

Colin
This topic is locked and can not be replied to.