{"id":19166,"date":"2016-06-03T07:59:38","date_gmt":"2016-06-03T12:59:38","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=19166"},"modified":"2022-06-03T03:42:52","modified_gmt":"2022-06-03T08:42:52","slug":"how-to-set-up-time-zone-on-centos-7","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-time-zone-on-centos-7\/","title":{"rendered":"How to set up time zone on CentOS 7"},"content":{"rendered":"
<\/p>\n
In this tutorial we are going to show you how to set up the time zone on a Linux VPS<\/a> running CentOS 7 as an operating system.<\/p>\n <\/p>\n To set up the time and date on CentOS 7 we are going to use the timedatectl command. It is an utility which is distributed as part of the systemd system and service manager. The timedatectl command has the following features:<\/p>\n – Review the current date and time First of all, connect to your CentOS VPS<\/a> via SSH. It is always a good practice to update all your system software to the latest version available. You can do that using the following command:<\/p>\n Once the update is completed, review the configuration of the system clock by using the timedatectl command:<\/p>\n The output of the command should be similar to the one above. As you can see, many information are provided in the output of the timedatectl command like local time, universal time, current time zone, whether NTP is enabled or not, last DST change, next DST change etc.<\/p>\n The next thing you might like to do is to set up the time zone. To list the time zones available you can use the following command:<\/p>\n The output is large and you can use grep to filter the results. For example, if you like to list the American time zones, you can use the command below:<\/p>\n To set up the time zone use the following command:<\/p>\n Here, you can replace America\/Chicago with the name of the time zone you like to set. Use the timedatectl command again to review the changes.<\/p>\n To set a specific time and date you can use the following syntax:<\/p>\n For example, to set up the current date to May-06-2016 and the current time to 21:55:00, use the command below:<\/p>\n More information on how to use the timedatectl command you can find by using the –help flag:<\/p>\n Of course you don\u2019t have to\u00a0set up timezone on CentOS 7 if you use one of our Managed CentOS VPS hosting<\/a> services, in which case you can simply ask our expert Linux admins to\u00a0set up time zone on CentOS 7 for you. They are available 24\u00d77 and will take care of your request immediately.<\/p>\n PS<\/span><\/strong>. If you liked this post, on\u00a0How to set up time zone on CentOS 7, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":" In this tutorial we are going to show you how to set up the time zone on a Linux VPS … <\/p>\n
\n– Change the date and time
\n– Set up the system time zone
\n– Enable an automatic synchronization of the system clock with a remote server
\n– …<\/p>\n# yum update<\/pre>\n
# timedatectl\r\n Local time: Fri 2016-06-02 04:21:01 EDT\r\n Universal time: Fri 2016-06-02 08:21:01 UTC\r\n RTC time: n\/a\r\n Time zone: America\/New_York (EDT, -0400)\r\n NTP enabled: n\/a\r\nNTP synchronized: no\r\n RTC in local TZ: no\r\n DST active: yes\r\n Last DST change: DST began at\r\n Sun 2016-03-13 01:59:59 EST\r\n Sun 2016-03-13 03:00:00 EDT\r\n Next DST change: DST ends (the clock jumps one hour backwards) at\r\n Sun 2016-11-06 01:59:59 EDT\r\n Sun 2016-11-06 01:00:00 EST\r\n<\/pre>\n
# timedatectl list-timezones<\/pre>\n
# timedatectl list-timezones | grep America\r\nAmerica\/Adak\r\nAmerica\/Anchorage\r\nAmerica\/Anguilla\r\nAmerica\/Antigua\r\nAmerica\/Araguaina\r\nAmerica\/Argentina\/Buenos_Aires\r\nAmerica\/Argentina\/Catamarca\r\nAmerica\/Argentina\/Cordoba\r\nAmerica\/Argentina\/Jujuy\r\nAmerica\/Argentina\/La_Rioja\r\nAmerica\/Argentina\/Mendoza\r\nAmerica\/Argentina\/Rio_Gallegos\r\nAmerica\/Argentina\/Salta\r\nAmerica\/Argentina\/San_Juan\r\nAmerica\/Argentina\/San_Luis\r\nAmerica\/Argentina\/Tucuman\r\nAmerica\/Argentina\/Ushuaia\r\nAmerica\/Aruba\r\nAmerica\/Asuncion\r\nAmerica\/Atikokan\r\nAmerica\/Bahia\r\nAmerica\/Bahia_Banderas\r\nAmerica\/Barbados\r\n...<\/pre>\n
# timedatectl set-timezone America\/Chicago<\/pre>\n
# timedatectl set-time 'YYYY-MM-DD HH:MM:SS'<\/pre>\n
# timedatectl set-time '2016-06-02 21:55:00'<\/pre>\n
# timedatectl --help\r\ntimedatectl [OPTIONS...] COMMAND ...\r\n\r\nQuery or change system time and date settings.\r\n\r\n -h --help Show this help message\r\n --version Show package version\r\n --no-pager Do not pipe output into a pager\r\n --no-ask-password Do not prompt for password\r\n -H --host=[USER@]HOST Operate on remote host\r\n -M --machine=CONTAINER Operate on local container\r\n --adjust-system-clock Adjust system clock when changing local RTC mode\r\n\r\nCommands:\r\n status Show current time settings\r\n set-time TIME Set system time\r\n set-timezone ZONE Set system time zone\r\n list-timezones Show known time zones\r\n set-local-rtc BOOL Control whether RTC is in local time\r\n set-ntp BOOL Control whether NTP is enabled\r\n<\/pre>\n
\n