Reputation: 325
I want to convert epoch milli seconds into Time without losing mill second information. Is it doable?
Upvotes: 1
Views: 631
Reputation: 1129
You should use Time.at
and then usec
method to get the microseconds of time.
epoch_milli = 1479383961245
t = Time.at(epoch_milli / 1000.0) # => 2016-11-17 09:59:21 -0200
micro = t.usec # => 244999
milli = micro / 1000.0 # => 244.999
Upvotes: 2