Tool
Ruby Unix Timestamp Snippets
Ruby examples for getting Unix seconds, deriving milliseconds, converting timestamps to Time objects, formatting UTC output, and parsing date strings.
Ruby timestamp basics
Ruby's Time.now.to_i returns Unix seconds. Use Time.now.to_f when you need fractional seconds or want to calculate milliseconds for APIs that expect JavaScript-style timestamps.
Converting and formatting Ruby Time
Use Time.at(timestamp) to create a Time object from Unix seconds. Call utc before formatting when you need stable output that does not depend on the machine's local timezone.