It is necessary that the date and time of your installed operating system must correct. Many jobs like the cron tasks that are running in the background and log entries of your system consist of specific timestamps. It is also helpful that the clock shows you the correct time when you are working on a desktop system. However, in this article, we will show you how you can adjust the date, time, and time zone of your CentOS 8 operating system.
The time, date, and time zone can be adjusted by using the following two different ways in CentOS 8:
- Changing date, time, and time zone using the graphical interface
- Changing date, time, and time zone by using the command-line / Terminal window
We will give you a demonstration of each method in detail one by one in the remaining article:
Method 1: Changing date and time using the graphical interface
You can set the date, time, and time zone of your CentOS system using the graphical environment in the following steps:
Step 1: Login into your CentOS system and click on the ‘Activities’ section from the top left corner of the desktop. Now, click on the menu icon which is also highlighted in the below-given image:
Step 2: Here, all application icons will be displayed on the desktop. Click on the ‘setting’ icon from the displayed window as follows:
Step 3: Now, the following window will show you on the screen. Click on the search icon from the displayed window’s corner and type the word ‘date and time’ in the search bar as follows:
Step 4: All relevant results will display in the left corner under the search bar. Click on the date and time clock icon which is also shown in the following screenshot:
Step 5: The following window will show on the desktop. Here, click on the date and time option from all listed options as follows:
Step 6: A dialog will display on the window where you can change the set the time and date according to your region timings. The ‘+’ sign will plus or increase the time and the ‘-’ sign will minimize or decrease it. Select the ‘month’ and similarly, you can set date and year using these symbols as follows:
When you will click on the month, the following drop-down list will appear where you can select the desired month.
Changing Time zone
To change the time zone, click on the ‘time zone’ from the displaying window as follows:
A search bar at the top of the window will display, type the region that you want to set, and press ‘Enter’. The desired time zone will automatically set on your system after doing this specified action.
You can also adjust the time format of 24 hours in ‘AM /PM’ format. So, choose the ‘Time Format’ from the displayed list as follows:
Method 2: Changing date, time, and time zone by using the command-line / Terminal window
There is a command through which you can adjust your system date and time. Using the ‘timedatectl’ you can display and adjust the date and time of your system. Therefore, open the terminal from the left sidebar of your desktop after clicking on the ‘Activities’ as follows:
By using the below-given command, you can view the current date, time of your operating system:
$ timedatectl
or
$ timedatectl status
To adjust the time of your system, type the following command on the terminal:
# timedatectl set-time 17:18:00
If you will get an error like the above. ‘Failed to set time: NTP unit is active’ then, by using the following command you will disable the NTP unit:
# timedatectl set-ntp false
Again, try to change the time of your system by running the following command and check the updated time:
# timedatectl set-time 17:18:00
Similarly, you can also adjust the date of your system.
# timedatectl set-time 2019-12-12
If you want to change both the date and time of your system at a time then, use the following command to adjust the date and time:
# timedatectl set-time ‘2021-01-05 16:18:45’
Changing Time zone
You can also set the time zone of your system using the command line. To view the list of all available time zones, type the following command:
# timedatectl list-timezones
To adjust the time zone of your system, type the following command on the terminal:
# timedatectl set-timezone Europe/Moscow
In the above command, you can replace ‘Europe/Moscow’ with your desired time zone.
Conclusion
We have discussed how you can easily adjust the time, date, and time zone of your system in CentOS 8 using two different methods. Now, you can set the time, date, and time zone of your CentOS system by following the above-mentioned ways. Please share with us your problem in case of any difficulty.