How do I format datetime in rails?

Use ruby’s strftime() on dates/datetimes:

<%= link_to timeslot.opening.strftime("%Y %m %d"), [@place, timeslot] %>

Have a look at the documentation to find out how the formatting works.

Leave a Comment