Formatting Dates in Rails 3.0
Posted
by Neil Middleton
on Stack Overflow
See other posts from Stack Overflow
or by Neil Middleton
Published on 2010-06-07T16:59:51Z
Indexed on
2010/06/07
17:02 UTC
Read the original article
Hit count: 250
ruby-on-rails
|activesupport
I'm trying to format a date in Rails 3 using the new syntax as described in the code:
by using the following syntax in an initialiser:
Date::DATE_FORMATS[:my_format] = '%m %d %Y'
I am then referencing dates in my view like so:
comment.created_at.to_formatted_s(:my_format)
However, I'm just getting the default formatting - what could be wrong?
© Stack Overflow or respective owner