0

I'm trying to format the date which is received from the query in rails but the value is not updated. Here is my code :-

@data = "My query"
@data.each do |eventdata|
      eventdata.start_date = eventdata.start_date.strftime("%Y-%m-%d %I:%M %p")
      puts "*******************"+eventdata.start_date.to_s
      eventdata.end_date = eventdata.end_date.strftime("%Y-%m-%d %I:%M %p")
end

The date received from my ajax call is in this format '2012-12-06T00:00:00+05:30',it is not updated. What could be the issue?

Also the event value printed on my console is ******************2012-12-06 00:00:00 +0530

4

1 回答 1

0

尝试

 eventdata.start_date.strftime("%Y-%m-%d %I:%M:%p") 

或者

 eventdata.start_date.strftime("%Y-%m-%d %H:%M:%S")
于 2012-12-06T13:53:21.143 回答