How do you format Rails timestamps in a more human-readable format? If I simply print out created_at
or updated_at
in my view like this:
<% @created = scenario.created_at %>
Then I will get:
2009-03-27 23:53:38 UTC
How do you format Rails timestamps in a more human-readable format? If I simply print out created_at
or updated_at
in my view like this:
<% @created = scenario.created_at %>
Then I will get:
2009-03-27 23:53:38 UTC
This post may point you in the right direction... Lots of samples dealing with default time format, format strings, etc.
The strftime
(from Ruby's Time) and to_formatted_s
(from Rails' ActiveSupport) functions should be able to handle all of your time-formatting needs.