Linux Server modifies timezone time

Source: Internet
Author: User
Tags local time

The consistency of time is critical, and the analysis of logs and the docking of the program are essential!

01. Tzselect Modify Time zone

You can use the command Tzselect to modify the time zone. Examples of operations:

$ 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.
# input 5,choose Asia
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
#9 input 9,choose China
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 Choose 1,Select Beijing time
The following information has been given:
east China - Beijing, Guangdong, Shanghai, etc.
Therefore TZ=‘Asia/Shanghai‘ will be used.
Local time is now: Mon Nov 9 13:40:51 CST 2015.
Universal Time is now: Mon Nov 9 05:40:51 UTC 2015.
Is the above information OK?
1) Yes
2) No
# 1 input 1 confirm
You can make this change permanent for yourself by appending the line
TZ=‘Asia/Shanghai‘; 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:

02. Modify the configuration file to modify the time zone

You can also change the time zone directly by modifying the configuration file.

    1. vi /etc/sysconfig/clock
    2. ZONE=Asia/Shanghai(Check the file under / usr / share / zoneinfo / Asia)
      rm / etc / localtime
      ln -sf / usr / share / zoneinfo / Asia / Shanghai / etc / localtime #Force a soft link
    3. Note: When the time zone is modified, the restart takes effect , and the time zone can use the order date-R.
03. The modified synchronization time CST may be considered as the standard time for the United States, Australia, Cuba or China.Chinese nameCstOverviewCST visible for the United States, AustraliaCentral US TimeCentral Standard Time (USA)China Standard Time China Standard Time ut+8:00 Cuba Standard TimeCubaStandard Time ut-4:00


Coordinated world time is based on the atomic time of the second length, at the moment as close to the world as possible when a measurement system

There are two Linux system clocks:

One is the hardware clock, which is the BIOS time , which is the time we see in the CMOS setup,

One is the system clock, which is the Linux system kernel time . When Linux starts, the system kernel reads the hardware clock settings, and the system clock is independent of the hardware. Sometimes we find that the system clock and hardware clock are inconsistent, so we need to perform time synchronization.

System clock

The date command sets the dates to June 18, 2014

----Date-s 06/18/14

Set the time to 14 points, 20 minutes, 50 seconds

----Date-s 14:20:50

Set the time to June 18, 2014 14:16 30 seconds (MMDDHHMMYYYY.SS)

----Date 0618141614.30

Hardware time

Hwclock/clock command to view, set hardware time

Viewing the system hardware clock

Hwclock--show or Clock--show

Set Hardware time

Hwclock--set--date= "06/18/14 14:55" (Month/day/year: minutes: seconds)

Clock--set--date= "06/18/14 14:55" (Month/day/year: minutes: seconds)

Synchronous system and hardware clock

You can see that the hardware and system clocks differ by half an hour. can be synchronized using hwclock or clock,

The hardware clock is synchronized with the system clock:

# Hwclock--hctosys or # clock--hctosys HC represents the hardware time, SYS represents the system time , i.e. the system clock is synchronized with the hardware clock

system clock and Hardware clock synchronization:

# Hwclock--SYSTOHC or # clock--SYSTOHC synchronize hardware clock with system clock

Linux Server modifies timezone time

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.