Having a problem parsing dates taken in from scraping a website using nokogiri. I scrape the datetime using
@date = h4.at('time[itemprop="startDate"]')[:datetime]
This gives me 2015-04-28 19:30:00 UTC
, which is inserted into my date column, of type datetime.
Using strptime I am trying to parse the date into a dd/mm format, and enter it into my rails table.
Date.strptime(@date, "%Y-%m-%d %H:%M:%S %Z").strftime("%m/%d/%Y")
@event=Event.new
@event.date= @date
Any help would be very much appreciated. Thanks in advance
Aucun commentaire:
Enregistrer un commentaire