CSV parsing with ruby


I am trying to learn how to parse a csv in ruby. In the class example,
the goal is to organize by the date field. Only thing is, I do not
recognize the
format. I think the date fields is encoded. I am new to ruby and have
gotten as far as to read the CSV in terminal. Is there a book or post
that explains the tools used to parse and potentially decode a field.
Here is a sample of the data I am working with:

id date
User1 1309380645
User2 1237178109



The Ruby Standard Library has a CSV class. Have a look at it. The
library documentation also contains small usage examples.

If that is in seconds. you can use Time.at(1309380645) https://ruby-doc.org/core-2.3.0/Time.html#method-c-at to format it

Time.at(1309380645) #=> 2011-06-29 15:50:45 -0500

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs