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.
661ae6e97d0e16c2af2aaf7d197e8387?d=identicon&s=25 Sijo k g (sijo)
on 2009-03-28 08: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
A1b97dafea62b11e7b3bef338ce3fe83?d=identicon&s=25 Billy Hsu (cfc)
on 2009-03-28 09: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
<rails-mailing-list@andreas-s.net>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
661ae6e97d0e16c2af2aaf7d197e8387?d=identicon&s=25 Sijo k g (sijo)
on 2009-03-28 12: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
5f94b9b346c2aa648a80bc259978e5bc?d=identicon&s=25 Colin Law (Guest)
on 2009-03-28 12:53
(Received via mailing list)
2009/3/28 Sijo Kg <rails-mailing-list@andreas-s.net>

>
> 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.