I can’t figure out how to format variables to custom
date/time formats. In a template, I have:
item.added.to_formatted_s(:format=>“%Y”)
and rather than the year, it outputs:
Mon Oct 31 20:14:14 MST 2005
Thanks for any help!
CSN
Yahoo! Mail - PC Magazine Editors’ Choice 2005
On 11/7/05, CSN [email protected] wrote:
I can’t figure out how to format variables to custom
date/time formats. In a template, I have:
item.added.to_formatted_s(:format=>“%Y”)
and rather than the year, it outputs:
Mon Oct 31 20:14:14 MST 2005
http://rails.rubyonrails.com/classes/ActiveSupport/CoreExtensions/Time/Conversions.html#M000186
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.update(:format
=> ‘%Y’)
item.added.to_s(:format)
–
rick
http://techno-weenie.net