Reputation: 207
The output from my hash is giving me the following date time:
16 May 11 13:12:14 +0000
How do I go about formatting this into something sensible?
Thanks
Upvotes: 0
Views: 656
Reputation: 6605
I'll assume you are wanting this output in a view... First, you can create some formats:
# /config/locales/en.yml:
en:
date:
formats:
full: "%b %d, %Y"
time:
formats:
full: "%B %d, %Y at %I:%M%p"
Then you can display a datetime in a view using the l
method with specified format:
<%= l @something.updated_at, :format => :full %>
This would display something like the following:
May 16, 2011 at 01:12pm
Upvotes: 1