Duration calculator

    Difference between two local datetimes (interpreted in the browser timezone).

    Human: 1dMs: 86,400,000

    Related Guides & Tutorials

    // developers also read

    Terminal Equivalent

    Compute elapsed time between two epoch values using shell arithmetic and GNU date.

    bash
    # Calculate duration between two timestamps
    echo $((1733569200 - 1700000000)) seconds
    
    # Convert to days
    echo "scale=2; (1733569200 - 1700000000) / 86400" | bc
    
    # Time since a specific date
    echo "Days since 2024-01-01:"
    echo $(( ($(date +%s) - $(date -d "2024-01-01" +%s)) / 86400 ))
    
    # Human-readable duration using GNU date
    start=1700000000
    end=1733569200
    diff=$((end - start))
    echo "$((diff/86400)) days, $((diff%86400/3600)) hours, \
    $((diff%3600/60)) minutes"

    Language Quick Reference

    python
    # Python
    from datetime import datetime, timezone
    
    start = datetime.fromtimestamp(1700000000, tz=timezone.utc)
    end = datetime.fromtimestamp(1733569200, tz=timezone.utc)
    delta = end - start
    print(f"{delta.days} days, "
          f"{delta.seconds // 3600} hours, "
          f"{(delta.seconds % 3600) // 60} minutes")

    How It Works

    Duration calculation subtracts two Unix timestamps to get a difference in seconds. Since timestamps are always in UTC, timezone differences don't affect the calculation — 86,400 seconds always equals one day regardless of DST. Watch out for leap seconds: UTC occasionally inserts a 61st second in a minute, making some days 86,401 seconds long. Most applications ignore this.