是否可以在我的 html 檔案中格式化日期?我收到的回復item.starts_at
starts_at: '2018-01-10 07:28:00'. 我想將此顯示為1 月 10 日
uj5u.com熱心網友回復:
<%= item.starts_at.strftime('%b %d') %>
uj5u.com熱心網友回復:
I18n.l(Date.today, format: :short)是您正在尋找的,Rails 包括這些本地化格式,更多詳細資訊:https ://github.com/rails/rails/blob/b2eb1d1c55a59fee1e6c4cba7030d8ceb524267c/activesupport/lib/active_support/locale/en.yml#L3
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/416228.html
標籤:
