dates and timestamps

Print dates in any format, turn epoch seconds into dates and back, use other time zones.

  • shell
  • text

Steps

  1. date +%F

    today as 2026-11-23

  2. date '+%Y-%m-%d %H:%M:%S'

    date and time

  3. date +%s

    seconds since 1970 (epoch)

  4. date -d @1700000000

    an epoch time as a date (GNU; macOS: date -r 1700000000)

  5. date -d 'yesterday' +%F

    yesterday, next monday, 3 days ago… (GNU)

  6. TZ=UTC date

    the time in another zone

Commands used

  • date

Each has a page in lore: lore date opens it.