Thedateis a command-line utility for Unix-like operating system to display date and time. Not just to view, you can also use the same command to set system date and time as well.

In this article, I’ll show how to use the date command in the Linux terminal to display date and time in different ways using several examples.

How To Display Date And Time In Linux Terminal Using Date Command?

Display Current Date And Time

Runningdatecommand in a console prints the current date and time in a default format string (“+%+”). It reads data from the kernel clock.

Display Date And Time In User-Defined Format

If you don’t like the default output format “+%+”, you can also change it and display it in your own format. What you need to do is write your own format using different format controls in a sequence.

Here are the important format controls available to display information:

Display Date And Time Of Different Timezone

Like every command-line utility, the date command also provides several options to modify the output result. For instance,-u,–utc, or–universalflag can be used with date command to print date and time in UTC (Universal Time Coordinate or Coordinated Universal Time).

Likewise, if you want to know the date and time of different timezone, you may also make use of the TZ environment variable with a date. Changing the value of TZ overrides the default timezone of your system.

Display date and time

Want to know the timezone information? you’re able to runtimedatectlto know your default timezone andtimedatectl list-timezonesto list all available time zones.

Get Past And Future Date

Using–dateor-doption, you can also display the past and future dates by giving a date string in the format of a date.

Past Date And Time

Future Date And Time

Get The Last Modified Date Of A File

You can also use the Linux date command to display the date and time of the last modification of a file using-rflag.

Display date and time with user-defined format

UTC date and time

Print date and time of different timezone