Linux date Command: Display and Format the Current Time
date displays the current date and time and outputs it in the specified format. It is especially useful for creating date strings in automation scripts.
What is the date command?
The default output is affected by the system timezone and locale. If you specify +FORMAT, you can output only the fields you need, and using -u displays it in Coordinated Universal Time (UTC). It also has the ability to actually set the time, but this should be distinguished from regular query operations.
Basic syntax
date [option] [+format]
Installed implementations and options may vary depending on the distribution. Check the current system's description with man date.
Examples
Current date and time
Outputs according to the default locale and timezone.
date
Consistent date format
Displays the date in year-month-day format for filenames or log identifiers.
date +%Y-%m-%d
Check UTC time
Reduces the time zone difference when comparing log times between servers.
date -u +%Y-%m-%dT%H:%M:%SZ
Understanding Display Formats and Time Zones
date can display the current time or change the format. The following command outputs the time in a fixed format based on UTC, but the date and values will vary each time it is run.
date -u '+%Y-%m-%d %H:%M UTC'
Example output:
2026-09-28 00:00 UTC
If you omit -u, the current system time zone setting will be applied. %Y is the four-digit year, %m is the month, and %d is the day. The above date is an example value for explanation and is not a record of setting the actual system time. Changing the system time affects authentication, logs, and scheduled tasks, so distinguish it from simple viewing.
Main Options and Format
| Options/Format | Description |
|---|---|
+%Y-%m-%d |
Outputs in year-month-day format. |
+%H:%M:%S |
Outputs hour:minute:second. |
-u |
Outputs in UTC. |
-I |
Outputs in ISO 8601 date format. |
-d string |
Interprets and displays the date string specified in GNU date. |
Precautions when using
Changing the system time using date -s can affect logs, authentication, and scheduled tasks. Check the time synchronization status before changing the clock. Quoting the format string may be necessary in the shell, and GNU-specific options differ from other Unix environments.
Frequently Asked Questions
Which time zone does the output of date follow?
By default, it follows the system or the time zone specified in the TZ environment variable. Use -u to view it in UTC.
Official Documentation
You can check the exact behavior of the options and implementation differences in the official date documentation.









