I can’t find how to format dates in Rails.
For example I want to display a datetime as:
“Tuesday, April 10th, 2007”
The closest I’ve been able to get is something like:
foo.created_at.to_s(:short)
Is there a way to pass options into the to_s method?
The “Time” class supports the POSIX standard “strftime()” function…
This
should get you everything except the “th” part:
foo.created_at.strftime(“%A, %B %-e, %Y”);
Cheers,
Tyler
Arch S. [email protected] wrote:
Is there a way to pass options into the to_s method?
–
Posted via http://www.ruby-forum.com/.
–
I can’t find how to format dates in Rails.
For example I want to display a datetime as:
“Tuesday, April 10th, 2007”
see:
http://whytheluckystiff.net/ruby/pickaxe/html/ref_c_time.html#Time.strftime