I am getting data from an API. The date attached to each object comes in this format:
Timestamp is the date and time of an event in UTC time. This is expressed as a specific number of milliseconds since the standard base "epoch" of: January 1, 1970, 00:00:00 GMT
I am trying to convert this into a different date format in Ruby.
CODE
objects.each do |obj|
p "object"
p obj.created
p Time.at(obj.created)
end
OUTPUT
"object"
1308886130000
43446-12-14 10:33:20 +1000
"object"
1308886104000
43446-12-14 03:20:00 +1000
"object"
1308801345000
43444-04-07 03:10:00 +1000
The years are obviously incorrect. What am I doing wrong?
I am using Ruby 1.9.2 and Rails 3.0.1