It is very important that the installed operating system has the correct date and time settings, since many programs running in the background (corn jobs) start at a certain time, and the log entries contain time stamps so that system events can be tracked in case of an error . And, of course, when working on the desktop, the clock should show the correct time 🙂
In this tutorial, we will show you how to set the date and time in CentOS 8 using the graphical interface, as well as using the shell (command line).
Set date and time using graphical user interface
Step 1. Log into your system and click “Actions”, which is present in the upper left corner of the CentOS 8 desktop.
Step 2. You will see several icons on the desktop. Click on the “Settings” icon in this window.
Step 3. Now a window will appear on the screen. Click the search icon, which will be available in the upper left corner of the display screen.
Step 4. In the search bar write “Date and time”. In response to your search action, the relevant results will appear in the current window.
Step 5. Click on this option. A different screen will appear in the system. Click on the date and time as shown in the image below.
Step 6. Now the interface will appear in the system, in which the “+” sign will increase the time, and “-” will decrease it. You can adjust the time according to your time zone. The day and year can also be set in the same way using the “+” and “-” signs.
In the “month” section, a drop-down menu is available in which you can select the desired month.
Step 7. You can also set the time zone by clicking on the “Time Zone” present in the current window.
In the search bar, write the name of the desired city in your region. The time zone will be set automatically after this step.
You can also set the time format for which you want to set it as a 24-hour or AM / PM format. You can configure it from the drop-down list.
Change date and time using CentOS Terminal
The timedatectl command allows us to set the time of the system clock. You can also use the “timedatectl” command to change the date and time zone.
To set the date and time using the terminal, you must perform the following steps:
Step 1. Open the terminal window using the key combination “Ctrl + Alt + t”.
Step 2. To display the already configured date and time on your system, enter the following command:
$ timedatectl status
Step 3. To check the current time zone of your operating system, write the following command:
To check all available time zones on your system, write the following command on the terminal:
$ timedatectl list-timezones
Step 4. To change the time of your operating system, enter the following command:
$ timedatectl set-time 16:19:00 $ timedatectl
The timedatectl set-time command is used to set the time. Correct format: HH: MM: SS, in which HH: MM hours: Minutes SS: Seconds. You can customize it accordingly.
Step 5. To configure the date, write the following command on the terminal:
$ timedatectl set-time 2019-12-12 $ timedatectl
The timedatectl set-time command is used to set the date. Format for adjusting the required date: YY: MM: DD, in which YY: Year MM: Month DD: Date. You can adjust the date accordingly.
Step 6. You can set the date and time at the same time. To do this, write the following command.
$ timedatectl set-time '2019-12-12 16:18:45' $ timedatectl
The format is available in the format GG-MM-DD HH: MM: SS. You can set the time and date as you want.
From this article, you learned how to set the time and date in CentOS 8. I hope this article will be useful to you. Now you can change the date and time of your Linux system. In case of any problems, you can share your problem through comments.
Set date and time in CentOS 8