How To Change the Default Time Zone in Linux Servers

How To Change the Default Time Zone in Linux Servers

If you want to change the default Time zone in Linux Servers use one of the following methods.

timezonetts

1. change the Timezone in /etc/localtime

[root@TTS ~]# date
Tue Jul 16 20:33:08 IST 2013[root@TTS ~]# cd /etc

[root@TTS etc]# ls localtime

localtime

[root@TTS etc]# ls /usr/share/zoneinfo/Asia/
Aden Bahrain Chungking Harbin Kabul Kuching Novokuznetsk Rangoon Shanghai Tokyo Yerevan
Almaty Baku Colombo Ho_Chi_Minh Kamchatka Kuwait Novosibirsk Riyadh Singapore Ujung_Pandang
Amman Bangkok Dacca Hong_Kong Karachi Macao Omsk Riyadh87 Taipei Ulaanbaatar
Anadyr Beirut Damascus Hovd Kashgar Macau Oral Riyadh88 Tashkent Ulan_Bator
Aqtau Bishkek Dhaka Irkutsk Kathmandu Magadan Phnom_Penh Riyadh89 Tbilisi Urumqi
Aqtobe Brunei Dili Istanbul Katmandu Makassar Pontianak Saigon Tehran Vientiane
Ashgabat Calcutta Dubai Jakarta Kolkata Manila Pyongyang Sakhalin Tel_Aviv Vladivostok
Ashkhabad Choibalsan Dushanbe Jayapura Krasnoyarsk Muscat Qatar Samarkand Thimbu Yakutsk
Baghdad Chongqing Gaza Jerusalem Kuala_Lumpur Nicosia Qyzylorda Seoul Thimphu Yekaterinburg

We will change to Time zone to Singapore

[root@TTS etc]# ln -s /usr/share/zoneinfo/Asia/Singapore localtime

[root@TTS etc]# date
Tue Jul 16 23:07:23 SGT 2013

now Timezone is changed to Singapore

2.Change Timezone using tzselect  we will change to Japan Timezone

[root@TTS etc]# tzselect

Please identify a location so that time zone rules can be set correctly.
Please select a continent or ocean.
1) Africa
2) Americas
3) Antarctica
4) Arctic Ocean
5) Asia
6) Atlantic Ocean
7) Australia
8) Europe
9) Indian Ocean
10) Pacific Ocean
11) none – I want to specify the time zone using the Posix TZ format.
#? 5
Please select a country.
1) Afghanistan 18) Israel 35) Palestine
2) Armenia 19) Japan 36) Philippines
3) Azerbaijan 20) Jordan 37) Qatar
4) Bahrain 21) Kazakhstan 38) Russia
5) Bangladesh 22) Korea (North) 39) Saudi Arabia
6) Bhutan 23) Korea (South) 40) Singapore
7) Brunei 24) Kuwait 41) Sri Lanka
8) Cambodia 25) Kyrgyzstan 42) Syria
9) China 26) Laos 43) Taiwan
10) Cyprus 27) Lebanon 44) Tajikistan
11) East Timor 28) Macau 45) Thailand
12) Georgia 29) Malaysia 46) Turkmenistan
13) Hong Kong 30) Mongolia 47) United Arab Emirates
14) India 31) Myanmar (Burma) 48) Uzbekistan
15) Indonesia 32) Nepal 49) Vietnam
16) Iran 33) Oman 50) Yemen
17) Iraq 34) Pakistan
#? 19

The following information has been given:

Japan

Therefore TZ=’Asia/Tokyo’ will be used.
Local time is now: Wed Jul 17 00:11:00 JST 2013.
Universal Time is now: Tue Jul 16 15:11:00 UTC 2013.
Is the above information OK?
1) Yes
2) No
#? 1

You can make this change permanent for yourself by appending the line
TZ=’Asia/Tokyo'; export TZ
to the file ‘.profile’ in your home directory; then log out and log in again.

Here is that TZ value again, this time on standard output so that you
can use the /usr/bin/tzselect command in shell scripts:
Asia/Tokyo

[root@TTS etc]# TZ=’Asia/Tokyo'; export TZ
[root@TTS etc]# date
Wed Jul 17 00:13:24 JST 2013

3. We can change Timezone in /etc/sysconfig/clock file

[root@TTS etc]# ls /usr/share/zoneinfo
Africa Asia Canada Cuba EST Factory GMT0 Hongkong Iran Japan Mexico Navajo Poland PRC ROK Universal W-SU
America Atlantic CET EET EST5EDT GB GMT-0 HST iso3166.tab Kwajalein Mideast NZ Portugal PST8PDT Singapore US zone.tab
Antarctica Australia Chile Egypt Etc GB-Eire GMT+0 Iceland Israel Libya MST NZ-CHAT posix right Turkey UTC Zulu
Arctic Brazil CST6CDT Eire Europe GMT Greenwich Indian Jamaica MET MST7MDT Pacific posixrules ROC UCT WET
[root@TTS etc]# ls /usr/share/zoneinfo/E
EET Egypt Eire EST EST5EDT Etc/ Europe/
[root@TTS etc]# ls /usr/share/zoneinfo/Europe/
Amsterdam Berlin Chisinau Helsinki Kiev Madrid Moscow Prague Sarajevo Tallinn Vatican Zagreb
Andorra Bratislava Copenhagen Isle_of_Man Lisbon Malta Nicosia Riga Simferopol Tirane Vienna Zaporozhye
Athens Brussels Dublin Istanbul Ljubljana Mariehamn Oslo Rome Skopje Tiraspol Vilnius Zurich
Belfast Bucharest Gibraltar Jersey London Minsk Paris Samara Sofia Uzhgorod Volgograd
Belgrade Budapest Guernsey Kaliningrad Luxembourg Monaco Podgorica San_Marino Stockholm Vaduz Warsaw

[root@TTS ~]# cat /etc/sysconfig/clock
# The time zone of the system is defined by the contents of /etc/localtime.
# This file is only for evaluation by system-config-date, do not rely on its
# contents elsewhere.
ZONE=”Asia/Kolkata”

i changed time zone to London

[root@TTS ~]# cat /etc/sysconfig/clock
# The time zone of the system is defined by the contents of /etc/localtime.
# This file is only for evaluation by system-config-date, do not rely on its
# contents elsewhere.
ZONE=”Europe/London”

[root@TTS ~]# source /etc/sysconfig/clock reload

4. We can change Timezone visually using system-config-date command

[root@TTS ~]# system-config-date

 

tmz




2 thoughts on “How To Change the Default Time Zone in Linux Servers

  1. Suvarna

    Can you please assist me, how to change time zone for any client if his account is hosted on c
    shared server environment ( Linux Platform ).

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *