1. Check the system time zone:
Method 1:
[Email protected] ~]# date-r
Sun, Sep 2014 23:10:23-0400
Method 2:
[Email protected] ~]# Cat/etc/sysconfig/clock
# The ZONE parameter is only evaluated by System-config-date.
# The timezone of the system is defined by the contents of/etc/localtime.
Zone= "America/new_york"
Utc=true
Arc=false
2. Modify the system time zone:
Method 1: Use Tzselect
[Email protected] ~]# Tzselect
Please identify a, so, 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
Pacific Ocean
One) None-i want to specify the time zone using the Posix TZ format.
#? 5
Please select a country.
1) Afghanistan Israel) Palestine
2) Armenia Japan) Philippines
3) Azerbaijan Jordan PNs) Qatar
4) Bahrain Kazakhstan) Russia
5) Bangladesh Korea (north), Saudi Arabia
6) Korea (south) Bhutan) Singapore
7) Brunei Kuwait) Sri Lanka
8) Cambodia Kyrgyzstan) Syria
9) Laos) Taiwan
(Cyprus) Lebanon) Tajikistan
(one) East Timor) Macau Thailand
(Georgia) Malaysia) Turkmenistan
Hong Kong) Mongolia Arab Emirates
India) Myanmar (Burma) Uzbekistan
(Indonesia) Nepal) Vietnam
Iran) Oman Yemen
() Iraq) Pakistan
#? 9
Please select one of the following time zone regions.
1) East China-beijing, Guangdong, Shanghai, etc.
2) Heilongjiang (except Mohe), Jilin
3) Central China-sichuan, Yunnan, Guangxi, Shaanxi, Guizhou, etc.
4) Most of Tibet & Xinjiang
5) West Tibet & Xinjiang
#? 1
The following information has been given:
China
East China-beijing, Guangdong, Shanghai, etc.
Therefore tz= ' Asia/shanghai ' would be used.
Local time is Now:mon SEP 8 11:19:54 CST 2014.
Universal time is Now:mon SEP 8 03:19:54 UTC 2014.
is the above information OK?
1) Yes
2) No
#? 1
You can make the permanent to yourself by appending the line
tz= ' Asia/shanghai '; Export TZ
To the file '. Profiles ' in your home directory; Then logs out and logs in again.
Here is the TZ value again, this time
can use The/usr/bin/tzselect command in shell scripts:
Asia/shanghai
[Email protected] ~]#
Method 2: Use Timeconfig (Redhat Linux and CentOS only)
Method 3: Copy the appropriate time zone file, replace the system time zone file, or create a linked file
cp/usr/share/zoneinfo/$ main time zone/$ times time zone/etc/localtime
For example: In set China time zone use Asia/Shanghai (+8)
Cp/usr/share/zoneinfo/asia/shanghai/etc/localtime
Modify the/etc/sysconfig/clock to the appropriate configuration:
[Email protected] asia]# Cat/etc/sysconfig/clock
# The ZONE parameter is only evaluated by System-config-date.
# The timezone of the system is defined by the contents of/etc/localtime.
Zone= "Asia/shanghai"
Utc=true
Arc=false
3. Write the modified information to Hwclock.
Hwclock-w
4. Verify that:
Hwclock
Date-r
This article is from the "Webseven" blog, make sure to keep this source http://webseven.blog.51cto.com/4388012/1549885
Linux How to view and modify time zones