date flags & options

+format

Display the date in a custom format using format specifiers.

date "+%Y-%m-%d"
date "+%Y-%m-%d %H:%M:%S"
date "+%A, %B %d, %Y"

-d, --date

Display a specific date string instead of the current time.

date -d "next Friday"
date -d "2 days ago" "+%Y-%m-%d"
date -d "2025-12-25" "+%A"

-u, --utc

Display or set the date in UTC instead of the local timezone.

date -u
date -u "+%H:%M:%S"

-r

Display the last modification time of a file.

date -r /etc/passwd
date -r app.log "+%Y-%m-%d %H:%M"

-I, --iso-8601

Output the date in ISO 8601 format.

date -I
date -Iseconds
date -Ins