Formatting timestamps

后端 未结 6 1318
旧时难觅i
旧时难觅i 2021-02-12 12:30

How do you format Rails timestamps in a more human-readable format? If I simply print out created_at or updated_at in my view like this:



        
6条回答
  •  情书的邮戳
    2021-02-12 12:38

    The strftime (from Ruby's Time) and to_formatted_s (from Rails' ActiveSupport) functions should be able to handle all of your time-formatting needs.

提交回复
热议问题