Transforming Datetime into month, day and year?

后端 未结 7 1972
北恋
北恋 2020-12-13 04:36

I can\'t seem to find this and I feel like it should be easy. In Ruby on Rails, how do I take:

2010-06-14 19:01:00 UTC

and turn it into

7条回答
  •  情歌与酒
    2020-12-13 05:07

    Update that is working in Rails 5 :

    <%= l @user.created_at, format: :short %>
    

    Internationalize :

    <%= I18n.l( @user.created_at, format: :short) %>
    

    You can use :long instead of :short

提交回复
热议问题