Set Date and Time in AlmaLinux 8, CentOS 8 and Rocky Linux 8 centos linux shell

It is very important that your installed operating system has the correct date and time settings because many programs that run in the background (cronjobs) are executed at certain times and also log entries contain timestamps so that system events can be traced in case of an error. And of course, if you’re 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 Rocky Linux 8, AlmaLinux 8, and CentOS 8 both from the GUI and from the shell (command line).

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 the date and time by using the terminal:

Step 1. Open the terminal window using shortcut keys ‘Ctrl Alt t’.

<img alt="CentOS Terminal" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/04/echo/word-image-528.png625591fc5ba00.jpg" data-ez ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="238" loading="lazy" src="data:image/svg xml,” width=”557″>

Step 2. To display the already adjusted date and time on your system, type the following command:

$ timedatectl status

<img alt="Timedatectl" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/04/echo/word-image-529.png625591fc7e634.jpg" data-ez ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="271" loading="lazy" src="data:image/svg xml,” width=”566″>

Step 3. To check the current Time zone of your operating system write following command:

$ timedatectl

<img data-ezsrc="https://kirelos.com/wp-content/uploads/2022/04/echo/word-image-530.png625591fca1ea8.jpg" data-ez ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="280" loading="lazy" src="data:image/svg xml,” width=”555″>

To check all available time zone in your system, write the following command on the terminal:

$ timedatectl list-timezones

<img alt="List time zones" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/04/echo/word-image-531.png625591fccc4e0.jpg" data-ez ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="374" loading="lazy" src="data:image/svg xml,” width=”505″>Advertisement

Step 4. To change the time of your operating system you can use the 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.

<img alt="Change system time" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/04/echo/word-image-532.png625591fcf2e25.jpg" data-ez ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="353" loading="lazy" src="data:image/svg xml,” width=”558″>

Step 5. To adjust the date, write the following command in 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.

<img alt="Change system date" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/04/echo/word-image-533.png625591fd2d75e.jpg" data-ez ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="298" loading="lazy" src="data:image/svg xml,” width=”571″>

Step 6. You can adjust both the 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.

<img alt="Change date and time in one step" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/04/echo/word-image-534.png625591fd5afa8.jpg" data-ez ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="339" loading="lazy" src="data:image/svg xml,” width=”555″>

Set Date and Time using the Graphical User Interface

Step 1. Login to your system and click on ’Activities’ that is present on the left top corner of the desktop on your Desktop.

<img alt="GNOME activities center" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/04/echo/word-image-518.png625591fd88cac.jpg" data-ez ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="236" loading="lazy" src="data:image/svg xml,” width=”552″>

Step 2. You will see a few icons on the desktop. Click on the “Settings” icon from this window.

<img alt="Settings" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/04/echo/word-image-519.png625591fdba5f1.jpg" data-ez ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="349" loading="lazy" src="data:image/svg xml,” width=”597″>

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.

<img alt="Settings search" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/04/echo/word-image-520.png625591fddf4bf.jpg" data-ez ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="381" loading="lazy" src="data:image/svg xml,” width=”619″>

Step 4. In the search bar, write “Date and time”. In response to your search action, relevant results will appear in the current window.

<img alt="Date and time settings" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/04/echo/word-image-521.png625591fdeef5a.jpg" data-ez ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="336" loading="lazy" src="data:image/svg xml,” width=”616″>

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.

<img alt="Change date and time" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/04/echo/word-image-522.png625591fe02125.jpg" data-ez ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="414" loading="lazy" src="data:image/svg xml,” width=”611″>

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 your time according to your time zone. Day and year can also be adjusted similarly by using ‘ ’ and ‘-’ signs.

<img alt="Date & Time" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/04/echo/word-image-523.png625591fe22834.jpg" data-ez ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="201" loading="lazy" src="data:image/svg xml,” width=”353″>

In the ‘month’ section, a drop-down menu is available from where you can select the desired month.

<img alt="Choose month" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/04/echo/word-image-524.png625591fe59b35.jpg" data-ez ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="411" loading="lazy" src="data:image/svg xml,” width=”613″>

Step 7. You can adjust the time zone as well by clicking on “Time Zone” present in the current window.

<img alt="Change timezone" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/04/echo/word-image-525.png625591fe60659.jpg" data-ez ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="432" loading="lazy" src="data:image/svg xml,” width=”589″>

In the search bar write the name of the desired city in your region. The time zone will be adjusted automatically after performing this action.

<img alt="Choose timezone on map" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/04/echo/word-image-526.png625591fe6acff.jpg" data-ez ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="348" loading="lazy" src="data:image/svg xml,” width=”619″>

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.

<img alt="Set time format" data-ezsrc="https://kirelos.com/wp-content/uploads/2022/04/echo/word-image-527.png625591fe9079a.jpg" data-ez ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="421" loading="lazy" src="data:image/svg xml,” width=”617″>

Conclusion

In this article, you have learned how to set time and date on RHEL based Linux distributions like AlmaLinux, CentOS, and Rocky Linux. 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.