date command (Linux / bash / sh / zsh)
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 / option | Meaning |
|---|---|
| +FORMAT | Format output with percent directives. |
| -u | Use Coordinated Universal Time. |
| -d STRING | Display 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.
Related commands
- crontabInstall, inspect, and edit per-user cron schedules.
- echoWrite arguments and shell-expanded values to standard output.
- systeminfoDisplay detailed operating system, hardware, boot, memory, and update information.
- systemctlControl and inspect services and other systemd units.
- Get-ServiceRetrieve service controller objects and current service states.
- exportMark shell variables for inheritance by child processes.
- setDisplay, create, or remove CMD environment variables.
- shutdownShut down, restart, sign out, or schedule power actions.
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.