Show and format¶
date # current date/time
date "+%Y-%m-%d %H:%M:%S" # 2026-09-20 14:30:00
date +%F_%H%M # 2026-09-20_1430 (good for file names)
date "+%A, %B %d - %T" # Sunday, September 20 - 14:30:00
date +%V # ISO week number of the year
date +%s # seconds since the Unix epoch
date --utc # UTC
date --rfc-email # Sun, 20 Sep 2026 14:30:00 -0400
date --iso-8601=seconds
date -r file # last modification time of a file
Calculations and other zones¶
date --date "+45 days" # 45 days from now
date --date "yesterday"
date --date "last friday"
date -d @1700000000 # epoch seconds to a readable date
date --date='TZ="America/Los_Angeles" 09:00 next Fri' # what time is that in your zone?
TZ=Europe/Berlin date # current time in another zone
Set the system clock¶
Normally do not: use NTP (timedatectl set-ntp true). To set it manually:
sudo date --set "2026-09-20 22:55:00"
sudo date 092022552026 # MMDDhhmmYYYY
sudo timedatectl set-time "2026-09-20 22:55:00"
Related: logger for timestamps in logs, hwclock in util-linux.