Adding extra data / time formats to your Rails application

In Elsewhere, Ruby on Rails

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.

Vaguely Related Posts (Usually)

Comments are closed.