It is very important that your installed operating system has the correct date and time. A lot of advantages while you properly maintain the time and date of your system. Many processes on your CentOS system, e.g. cronjobs, depend on the correct date and time settings.
In this tutorial, we will explore the two different ways to set the date and time in CentOS 8.
Set date and Time By using 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 a 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.
By using terminal the Window
The ‘timedatectl’ is the command which allows us to change and configure the settings of our 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 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 the 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
The ‘timedatectl set-time’ command is used to adjust time. 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 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 to adjust required date is YY: MM: DD in which YY: Year MM: Month DD: Date. You can adjust date accordingly.
Step 6. You can adjust both date and time 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 for 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.