Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

Adding extra data / time formats to your Rails application

By Peter Cooper / August 11, 2006

ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!(
  :default => "%m/%d/%Y",
  :date_time12 => "%m/%d/%Y %I:%M%p",
  :date_time24 => "%m/%d/%Y %H:%M"
)

Richard Leonard demonstrates how to use the date formats that come with Rails, as well as how to override or add some of your own directly into Rails' helpers on the fly.

Other Posts to Enjoy

Twitter Mentions