In Rails, I find that timestamps in the console look different to the actual html view even when you have the same code. Unless I'm doing something really stupid:
>> article = News.first
=> #<News id: 1, title: "Testing", body: "yadda yadda", role_id: 1, created_at: "2009-04-12 05:33:07", updated_at: "2009-04-12 05:33:07">
>> article.created_at
=> Sun, 12 Apr 2009 05:33:07 UTC +00:00
>> article.created_at.to_date
=> Sun, 12 Apr 2009
And in the view:
<% for article in @news %>
<% @current_date = article.created_at.to_date %>
<% if @current_date != @date %>
<%= @current_date %>
<% @date = @current_date %>
<% end %>
The output will be:
2009-04-14
Why are the formats different?