To display date and time under Linux operating system using command prompt use the date command. It can also display the current time / date in the given FORMAT. We can set the system date and time as root user too.
Open a terminal and type the following command:
Sat Nov 7 22:44:59 IST 2009
You can format the date as follows in dd-mm-yy format:
To print the date of the day before yesterday, run:
date --date='2 days ago'
Want to see the day of year of Christmas in the current year? Try:
date --date='25 Dec' +%j
Display the current full month name and the day of the month:
date '+%B %d'
Display date and time un Linux using the timedatectl
Most modern Linux distro with systemd use the timedatectl command. It is used to query and change the system clock and its settings, and enable or disable time synchronization services. All you have to do is type the following command:
GUI Tool: Time Administration
The Time Administration Tool allows you to set the time, date and timezone of your system, as well as setting any time server to synchronize your local time server. Type the following command to start time admin tool:
## OR ##
You may be prompted for the administrator password (root password), this is necessary because the changes done with this tool will affect the whole system.
How to change date and time settings with Gnome based Linux desktop
First, you need to Settings in Activities and then click Details in the sidebar. Make sure you click Date & Time in the sidebar to open the panel:
In this quick tutorial, you learned about the date command that you can use to see or change the date/time under Linux operating systems. We further explained how to use the GUI tools too. The date command has many more options. See man page by typing the following man command:
$ man date