In my Rails view, I have the below code that displays a datetime.
<%= link_to timeslot.opening, [@place, timeslot] %>
The result of this
You should use a helper for this.
If you want to convert from UTC to PST you can use the in_time_zone
method
def convert_time(datetime)
time = Time.parse(datetime).in_time_zone("Pacific Time (US & Canada)")
time.strftime("%-d/%-m/%y: %H:%M %Z")
end
<%= link_to convert_time(timeslot.opening), [@place, timeslot] %>