Ruby Forum Rails I18n > DateFields and ActiveRecords

Posted by Jonas (Guest)
on 01.07.2007 13:36
Here is some typical code, right?

<% for column in User.visible_columns true %>
<tr>
  <th><%= column.human_name %></th>
  <td><%=h @user.send(column.name) %></td>
</tr>
<% end %>

I want to customize how the date is formatted for timestamps. How do I
do that? (I want the code above to automatically use my new format for
timestamp/datetime columns)
Posted by Moises Deniz (railsgeek)
on 02.07.2007 13:52
> 
> <% for column in User.visible_columns true %>
> <tr>
>   <th><%= column.human_name %></th>
>   <td><%=h @user.send(column.name) %></td>
> </tr>
> <% end %>
> 
> I want to customize how the date is formatted for timestamps. How do I
> do that? (I want the code above to automatically use my new format for
> timestamp/datetime columns)

Try modifing the DATE_FORMATS[:db] constant with your own format...

you can see at:
http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Time/Conversions.html