I am using this to get a select with all dates:
options_from_collection_for_select(@expiration_dates, :exp_date, :exp_date)
which return me with this:
2010-10-21 14:01:38 +0200
2010-12-19 12:01:18 +0200
However, i need to convert that result to a format of “d-m”, but when I used
:exp_date.strftime("%d-%m")
it returns an error obviously, because it is a string object which I treat as a time object.
How can I convert the value and display it?
If you make a method in your model, you can call it in the options_from_collection_for_select, so:
in your model: