date

date prints the current date and time. An optional format string follows +.

date +"<format string>"

Format

Example format and output:

%a %b %e %H:%M:$S %Z %Y
Thu Feb 2 03:28: CET 2012

Assignment

When assigning, use command substitution:

`date [+<format string>]`

There is no direct assignment. The value must be echoed. date echoes when assigned as var=<space>date (a space after =), because date is then run as a command.

Updated: 2026 Aug 19