Epoch Converter for Ruby — Time.now.to_i & Time.at
Quick Answer: Ruby Time.now.to_i returns epoch seconds. Convert from epoch: Time.at(1704067200).utc. In Rails, use Time.zone.at(1704067200) to respect the application timezone setting.
Current Unix Epoch
1776009213
2026-04-12T15:53:33.000Z
FAQ
How do I convert epoch to Time in Ruby?
Time.at(1704067200) returns a Time object in local timezone. Append .utc for UTC. In Rails, Time.zone.at(epoch) uses the app timezone.
What about millisecond timestamps?
Time.at(epoch_ms / 1000.0) handles milliseconds. Ruby Time.at accepts a Float for sub-second precision.