Acrux Acrux - 1 year ago 46
Ruby Question

How to use srtftime in views

I am getting an error with


My views look like:

works and yields "2017-07-27".

However, I want to convert this to July 27, 2017.

<%= Date.parse("%B %e, %Y ") %>
does not work and causes the following error: "ActionView::Template::Error (no implicit conversion of Date into String)":

My schema is: "date"

I don't know what I am doing wrong. Thanks!

Answer Source

If your is type of date you shouldn't try to parse it. So I'd suggest first try to use <%='%B %e, %Y'). Please comment below if that wont work.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download