How to change default format of Date in Rails 3?

后端 未结 2 2012
醉梦人生
醉梦人生 2021-01-15 05:49

I\'m having problem with the date format of rails. It seems to me that the default Date Format is dd/mm/yyyy. How am I gonna change it to something like m

2条回答
  •  萌比男神i
    2021-01-15 06:16

    Put following line in your enviroment.rb

    Date::DATE_FORMATS.merge!(:default => "%m/%d/%Y")
    

    and try

     Time.now.to_date.to_s
    

    On you rails console

提交回复
热议问题