I could you some assistance formatting a date field in a drop-down list in a for in a view. My dates are showing with a time-stamp and I'd like them to show as "mm/dd/yyyy".
In my model I have a method selecting a date field from the table:
def self.get_event_dates
event_dates = UgradRsvp.find_by_sql("select distinct event_date from admissions.ugrad_rsvps where event_date is not null order by event_date desc")
end
We use Oracle as our db, so I also tried using to_char(event_date, 'MM/DD/YYYY') as event_date, but the dates in my drop-down still show with a time-stamp.
My view is a search form. Users will select a date and then see a report of all students signed up for an event on that event_date:
<%= select_tag "event_date", options_from_collection_for_select(UgradRsvp.get_event_dates, "event_date", "event_date") %>
There are about eight dates in my table ugrad_rsvps. They are showing as, i.e: "2013-04-18 00:00:00 -0400" I'd like to have them show as "04/18/2013". I've tried using strftime("%m/%d/%Y"), but I just get errors on the line in my view for the drop-down (above).
Any ideas? Thanks,