Ahmed Abdelsalam wrote:
I want to extract month name and year only from the DateTime format to
display it as: November 2009.

FYI: If you find yourself using the same custom date/time format in
multiple places in your application you can DRY that up by adding to the
named date/time formats using:

ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge! (:concise
=> "%d.%b.%y")

Excerpt from:
http://ryandaigle.com/articles/2007/2/23/what-s-new-in-edge-rails-stop-littering-your-evnrionment-rb-with-custom-initializations

You can shorten that up by creating config/initializers/ time_formats.rb and dropping this into it:

Date::DATE_FORMATS[:concise] = Time::DATE_FORMATS[:concise] = "%d.%b.%y"

--
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to