2
我使用它來獲取一個選擇的所有日期:的strftime爲options_from_collection_for_select
options_from_collection_for_select(@expiration_dates, :exp_date, :exp_date)
這回我這個:
2010-10-21 14:01:38 +0200
2010-12-19 12:01:18 +0200
但是,我需要的是結果轉換成的格式「dm」,但是當我用
:exp_date.strftime("%d-%m")
它顯然返回一個錯誤,因爲它是一個字符串對象,我把它當作時間對象。 如何轉換該值並顯示它?在模型中
options_from_collection_for_select(@expiration_dates, :exp_date, :exp_date_label)
:
你是我的英雄:-) – John 2012-03-08 18:43:27
公頃!很高興我能幫上忙。 – miked 2012-03-08 20:44:35
哇這是一個聰明的主意;) – Trip 2012-10-08 21:46:08