In the following of CentOS 7 Linux tutorials, In this article we are going to learn, how to set Timezone on CentOS 7 Linux. As you know, setting the time and date of the operating system on servers is very important and is a requirement for operating in the world of internet and service. In this tutorial, you will get acquainted with the timedatectl and Date commands and you will learn how it works.
Set Timezone on CentOS 7 Linux
1- To see the time position as well as your server time information, you can enter the following command.
After entering the above command, the output will be displayed as follows.
If the time and date of CentOS 7 need to be changed, stay tuned.
2- You can do the following to set your system clock.
timedatectl set-time 18:23:45
By entering the above command, your system time will change to 22:23:45.
3- To set the time and date of the operating system simultaneously, you can proceed as follows.
timedatectl set-time "2017-04-15 22:37:22"
So far, you’ve learned how to set the time and date of the CentOS 7 Linux, Here’s how to set up TimeZone.
How to change date and time on CentOS 7 Linux
1- To set the time zone, you must proceed as follows.
timedatectl set-timezone America/NewYork
By entering the above command, the server’s time zone to NewYork will change.
2- If you are considering another time zone, you can find the list of time zones by the following command.
3- Or you can use the following mode to search among time zones.
timedatectl list-timezones | grep -i york
After entering the above command, the area is displayed when the word york is used.
4- Finally, you can use the following command to get the whole list of time zones of a continent.
timedatectl list-timezones | grep America
5- You can also set your CentOS 7 Linux clock and date to the NTP server.
timedatectl set-ntp yes
Please note: you can use the word no instead of the word yes instead of the NTP server to disable the setting.
So far, you’ve learned how to use the timedatectl command, but you can also use the date command to set the time and date on Linux.
Set the time and date by the Date command
1- Use the following structure to set the time of CentOS 7 with the date command.
date --set HH:MM:SS
date --set 18:26:10
2- Use the following mode to set the date of CentOS 7 by the date command.
date --set YYYY-MM-DD
date --set 2020-02-29
3- Finally, if you need to set the time and date at the same time, enter the following command.
date --set 2020-2-28 18:26:12
Here’s how to set the time and date of CentOS 7 Linux to date and timedatectl commands.
If you are using CentOS 6 Linux, you can refer to the time and date setting of Linux CentOS 6.
Dear user, we wish this tutorial would be helpful for you, to ask any question or review the conversation of our users about this article, please visit Ask page. Also to improve your knowledge, there are so many useful tutorials ready to on Eldernode training.