Reputation: 2809
I have ann app that has a start_date and an end_date that is currently in the format Thu, 23 Apr 2015 17:00:00 UTC +00:00
and the field type is datetime.
I am needing to convert it into this YYYY-MM-DDThh:mm:ssZ
for the Eventbrite API but I am having little luck.
I have tried iso = Time.iso8601(start_date)
but I get the following error TypeError: no implicit conversion of ActiveSupport::TimeWithZone into String
Anyone able to point me in the right direction it would be very much appreciated.
Upvotes: 5
Views: 3030
Reputation: 3721
try following:
start_date.iso8601
output
=> "2015-05-06T15:53:51+05:00"
Upvotes: 9