views:

67

answers:

1

I'm trying to format a date in Rails 3 using the new syntax as described in the code:

http://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/date/conversions.rb

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?

A: 

It would appear that the following 'to_date' is required:

comment.created_at.to_date.to_formatted_s(:my_format)
Neil Middleton