It is very important that your installed operating system has the correct date and time settings as many programs that run in the background (corn jobs) are run at specific times and also log entries contain timestamps so that system events can get traced back in case of an error. And of course, when working on the desktop, the clock should show the correct time as well 🙂
In this tutorial, we will show you how to set date and time in CentOS 8 using the GUI and also using the shell (command line).
Set Date and Time using the Graphical User Interface
Step 1. Login to your system and click on ’Activities’ that is present on its left top corner of the desktop on CentOS 8.
Step 2. You will see the few icons on the desktop. Click on the “Settings” icon from this window.
Step 3. Now, a window will appear on the screen. Click on the search icon that will available on the left top corner of the display screen.
Step 4. In the search bar, write “Date and time”. In response to your search action, relevant results will appear in the current window.
Step 5. Click on that option. Another screen will appear on the system. Click on Date and time as highlighted in the below-mentioned image.
Step 6. Now, an interface will appear on the system in which the “+” sign will increase the time and “-” will decrease it. You can adjust time according to your time zone. Day and year can also be adjusted similarly by using ‘+’ and ‘-’ signs.
In the ‘month’ section, a drop-down menu is available from where you can select the desired month.
Step 7. You can adjust the time zone as well by clicking on “Time Zone” present on the current window.
In the search bar write the name of the desired city of your region. The time zone will be adjusted automatically after performing this action.
You can also adjust the time format to which you want to adjust it as 24-hours or AM/PM format. You can adjust it from the drop-down.
Change Date & Time using CentOS Terminal
The command ‘timedatectl’ allows us to set the time of the system clock. You can also use the ‘timedatectl’ command to change the date and time zone.
The following steps are involved to set date and time by using the terminal:
Step 1. Open the terminal window using shortcut keys ‘Ctrl + Alt + t’.
Step 2. To display the already adjusted date and time on your system, type the following command:
$ timedatectl status
Step 3. To check the current Time zone of your operating system write following command:
To check all available time zone in your system, write the following command on the terminal:
$ timedatectl list-timezones
Step 4. To change the time of your operating system type following command:
$ timedatectl set-time 16:19:00 $ timedatectl
The ‘timedatectl set-time’ command is used to adjust the time. The correct format is HH:MM:SS in which HH: Hours MM: Minutes SS: Seconds. You can adjust it accordingly.
Step 5. To adjust the date, write following command on the terminal:
$ timedatectl set-time 2019-12-12 $ timedatectl
The ‘timedatectl set-time’ command is used to set the date. Format to adjust the required date is YY: MM: DD in which YY: Year MM: Month DD: Date. You can adjust the date accordingly.
Step 6. You can adjust both date and times at once. For this purpose write the following command.
$ timedatectl set-time '2019-12-12 16:18:45' $ timedatectl
The format is available in YY-MM-DD HH:MM: SS. You can adjust the time and date as you want.
In this article, you have learned how to set time and date on CentOS 8. I hope this article would useful to you. Now, you are able to change the date and time of your Linux system. In case of any problem, you can share your problem via comments.