Custom date time format in rails 4
ruby-on-rails-4
Solution
If you want to use `@review.created_at.to_s(:submitted)`, I think you need to use `Time::DATE_FORMATS[:submitted] = "%b %d %Y"` (use square brackets instead of parentheses)
I believe the localization file output format is usable through Rails' `#l` helper http://guides.rubyonrails.org/i18n.html#adding-date-time-formats. So `<%= l review.created_at, format: :submitted %>` should work in an `erb` view
Problem
I want to display a custom date format in rails 4 by calling something like: `@reveiw.created_at.to_s(:submitted)` So far I have tried: ``` Time::DATE_FORMATS(:submitted) = "%b %d %Y" ``` in my config/environment.rb and config/initializers/time_formats.rb files. I have also added the following code to my config/locales/en.yml file ``` en: time: formats: submitted: "%b %d %Y" ``` I have not had success. Is there a definitive strategy for rails 4?