Skip to main content

Command referencedate

date command (Linux / bash / sh / zsh)

Linuxbashshzshsystembeginner

What it does

Display or format the system date and time. When people search for the date command linux format, they usually want date's everyday flags, safe examples, and how it differs from related tools. Below you'll find syntax, options, and copyable examples for Bash/sh/zsh.

Display or format the system date and time.

Syntax

date [OPTION]... [+FORMAT]

Common options

Flag / optionMeaning
+FORMATFormat output with percent directives.
-uUse Coordinated Universal Time.
-d STRINGDisplay a parsed date rather than now.
-I[PRECISION]Use ISO 8601 output.

Practical examples

ISO date

date -I

Prints the current calendar date.

UTC timestamp

date -u '+%Y-%m-%dT%H:%M:%SZ'

Prints an RFC 3339-like UTC value.

Relative date

date -d 'next Monday' '+%F'

Parses and formats the next Monday.

Common mistakes

  • Using GNU `-d` in scripts intended for systems with BSD date.
  • Setting the system clock accidentally when only formatting was intended.

FAQ

What does date do in Linux?

Display or format the system date and time.

How do I use date from the terminal?

Start with `date [OPTION]... [+FORMAT]`, then choose only the options needed for the task.

What is a practical date example?

Try `date -I` — Prints the current calendar date.

Can I use date in a shell script?

Yes. date works in Bash, sh, and Zsh, but scripts should handle quoting, errors, and command output explicitly.

Browse the full Linux and Windows command reference to search more bash, CMD, PowerShell, Conda, and GitHub CLI commands.