date command in Linux: current date and formats
Updated July 3, 2026
The date command shows the current date and time and can format them.
Syntax
date [+FORMAT]Common cases
date # the full date and time
date +%Y # the year only, four digits
date +%Y-%m-%d # year-month-day
date -u # the time in UTCHow it works: the format string
An argument that starts with
+is a format string:%Yis the year,%mthe month,%dthe day,%H:%M:%Shours, minutes and seconds. Everything else prints as is, sodate +%Y-%m-%dgives2026-06-26. The system stores time as a count of seconds since 1970 (Unix time), anddateonly renders it for your timezone.
Used in
You need this in the lesson The command line. The theory is the chapter The command line: first contact.
See also
Try it
Open the sandbox: a real throwaway Linux terminal in your browser. Run the commands above by hand - the container is deleted when you leave.