Re: How to convert long/milliseconds to DateTime?

From: [email protected] [mailto:[email protected]]

irb(main):003:0> Time.at(1161275493444 / 1000.0)
=> Thu Oct 19 11:31:33 CDT 2006

That trailing “.0” is important (and I omitted it in my answer), if you
want to preserve the sub-second resolution present in your long value.
(Without it, Ruby will perform integer arithmetic and your resulting
Time instance will fall exactly on a second boundary.)

Good point, Kirk.