Rails date format in a text_field

后端 未结 14 2164
傲寒
傲寒 2020-12-13 06:05

I have a rails form that displays a date in a text_field:

<%= form.text_field :check_in_date  %>

The date is rendered as yyyy-m

14条回答
  •  [愿得一人]
    2020-12-13 06:35

    If you can set the value manually you can use created_at.strftime("%m-%d-%Y") http://snippets.dzone.com/tag/strftime .

提交回复
热议问题