Epoch & Unix Timestamp in Ruby
Get the current epoch timestamp
epoch_seconds = Time.now.to_i Convert epoch to date
t = Time.at(1718200000).utc Convert date to epoch
epoch = Time.utc(2026, 6, 12).to_i Ruby notes
Time.at interprets in the local zone — chain .utc for UTC. to_f gives fractional seconds; strftime('%s') also returns epoch seconds as a string.
Check any value live with the epoch converter, or read what Unix time actually counts.
Other languages
C · C# · C++ · Dart · Go · Java · JavaScript · Kotlin · MySQL · Perl · PHP · PostgreSQL · Python · R · Rust · Scala · SQLite · Swift · TypeScript