EpochTools
Systems

Unix Timestamps in Rust

Standard library SystemTime and popular chrono crate.

Complete Rust Recipe

use std::time::{SystemTime, UNIX_EPOCH};

fn main() {
    // 1. Current Unix timestamp (Standard Library)
    let start = SystemTime::now();
    let since_epoch = start.duration_since(UNIX_EPOCH).expect("Time went backwards");
    let in_seconds = since_epoch.as_secs();

    // 2. With Chrono crate:
    // use chrono::{DateTime, Utc};
    // let dt = DateTime::from_timestamp(1710000000, 0).unwrap();
    // println!("{}", dt.to_rfc3339());
    
    println!("Current epoch seconds: {}", in_seconds);
}

Test With Live Converter

Epoch → Human Date

Paste any Unix timestamp. The unit is auto-detected from its magnitude.

Auto-detects seconds, milliseconds, microseconds, or nanoseconds. Example: 1735689600

Detected:Auto (Seconds)

UTC ISO 8601

–

Local — auto

–

RFC 2822 / GMT

–

Seconds Value

–

Relative Time

–