According to documentation at http://guides.rubyonrails.org/i18n.html#adding-date-time-formats, the best way to ask for specific formats for a date is to define them in /config/locales/en.yml. I've copied and pasted this file: https://github.com/rails/rails/blob/master/activesupport/lib/active_support/locale/en.yml to my locales directory.
I've made a few changes (asterisks for emphasis only):
"en-US":
date:
formats:
default: "%Y-%m-%d"
**short: "short %b %d"**
and
time:
formats:
default: "%a, %d %b %Y %H:%M:%S %z "
**short: "short %B %d, %Y"**
And in my partial:
<%= l item.create_date, :format => :short %>
where create_date is a datetime row in my database of items.
I've restarted my server but am still getting a date formatted like this: 15 Mar 00:00
I have a feeling that it is because i'm using neither a date or a time. I can't find the definition of "short" or "long" for datetime. I tried adding it to this file by adding this code:
datetime:
formats:
short: "short %B %d, %Y"
no luck. What am I missing. I feel like I'm following the instructions directly. Thanks!
item.create_date.class
onrails console
(or just dumping it on the screen?) – Fábio Batista