System Timezone
Change Timezone on CentOS/RHEL 7/6/5
# date 041712132018 [ 04 month-17 date-12 hour-13 minute-2018 year ]
[root@mail ~]# date
Tue Apr 17 12:31:57 BDT 2018
First check current timezone used by your system using date command.
[root@tecadmin ~]# date Fri Jan 2 05:10:00 EST 2015
As per above example our system timezone is set to EST.
Change TimeZone in CentOS/RHEL 7
In CentOS/RHEL 7 we use timedatectl command to change current timezone of system. First use following command to list all timezones
# timedatectl list-timezones
Now use following command to change timezone to America/Los_Angeles.
# timedatectl set-timezone America/Los_Angeles
Change TimeZone in CentOS/RHEL 6/5
To change timezone on CentOS/RHEL 6/5 we can simply link /etc/localtime file with correct timezone configuration file. For example we are setting America/Los_Angeles as our local system timezone.
# mv /etc/localtime /root/localtime.old # ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
Your timezone has been changed successfully. Lets check timezone again.
[root@tecadmin ~]# date Fri Jan 2 14:10:54 IST 2015
---------------X------------------
Centos 6
Set System Timezone
The example for setting time-zone of your system.
[root@dlp ~]# vi /etc/sysconfig/clock
# change to your location
ZONE="Asia/Tokyo"
[root@dlp ~]# source /etc/sysconfig/clock # reload
# copy your timezone file under the "/usr/share/zoneinfo" like follows
[root@dlp ~]# cp -p /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
cp: overwrite `/etc/localtime'? y
Centos 7
Replace to your own timezone on the example below.
# show the list of timezones
[root@dlp ~]# timedatectl list-timezones
Asia/Aden Asia/Almaty Asia/Amman Asia/Anadyr Asia/Aqtau Asia/Aqtobe Asia/Ashgabat ... ... ... Pacific/Rarotonga Pacific/Saipan Pacific/Tahiti Pacific/Tarawa Pacific/Tongatapu Pacific/Wake Pacific/Wallis
# set timezone
[root@dlp ~]# timedatectl set-timezone Asia/Tokyo
# show status
[root@dlp ~]# timedatectl
Local time: Wed 2014-07-09 18:31:16 JST Universal time: Wed 2014-07-09 09:31:16 UTC RTC time: Wed 2014-07-09 09:31:15 Timezone: Asia/Tokyo (JST, +0900) NTP enabled: yes NTP synchronized: yes RTC in local TZ: no DST active: n/a
----------------------------------