In a linux system timezones are defined under the directory “/usr/share/zoneinfo/”.
[email protected]:~# cd /usr/share/zoneinfo/ [email protected]:/usr/share/zoneinfo# ls Africa Asia Canada Cuba EST Factory GMT0 Hongkong Iran Japan localtime MST7MDT Pacific posixrules ROC Turkey UTC zone.tab America Atlantic CET EET EST5EDT GB GMT-0 HST iso3166.tab Kwajalein MET Navajo Poland PRC ROK UCT WET Zulu Antarctica Australia Chile Egypt Etc GB-Eire GMT+0 Iceland Israel leap-seconds.list Mexico NZ Portugal PST8PDT Singapore Universal W-SU Arctic Brazil CST6CDT Eire Europe GMT Greenwich Indian Jamaica Libya MST NZ-CHAT posix right SystemV US zone1970.tab [email protected]:/usr/share/zoneinfo#
Also, a system’s timezone is defined in the file “/etc/localtime”. This file is generally linked with one of the files in the directory “/usr/share/zoneinfo/”.
[email protected]:~# ls -l /etc/localtime lrwxrwxrwx 1 root root 32 Feb 17 03:12 /etc/localtime -> /usr/share/zoneinfo/Asia/Kolkata [email protected]:~#
So we can change the timezone by simply linking the file “/etc/localtime” with the respective zone file from “/usr/share/zoneinfo/”.
Suppose we want to change my timezone from IST to UTS, we can do so as :
[email protected]:~# [email protected]:~# date Mon Feb 20 02:49:27 IST 2017 [email protected]:~# ln -sf /usr/share/zoneinfo/UTC /etc/localtime [email protected]:~# date Sun Feb 19 21:19:44 UTC 2017 [email protected]:~#
If we want to use the timezone based upon region, we can find the desired timezone file in “/usr/share/zoneinfo/”. Like timezone file for IST (Indian Standard Time, i.e., Kolkata) is “/usr/share/zoneinfo/Asia/Kolkata”.