Tuning the Linux operating system time zone-CENTOS7

Source: Internet
Author: User
Tags local time

If your Linux system time zone is not configured correctly, you will need to manually adjust to the correct local time zone. NTP's synchronous processing of time only calculates the local time offset from UTC time, so configuring an NTP to synchronize time does not resolve the problem of the incorrect time zone. So when you use a foreign cloud service provider such as Microsoft Azure or other VPS, virtual machines, you need to be aware of the same time zone in mainland China

[[Email protected] yum.repos.d]# Date
Sun Mar 21:39:46 EDT 2018
[Email protected] yum.repos.d]# ls-l/etc/localtime
lrwxrwxrwx. 1 root root 13:22/etc/localtime Jan 2. /usr/share/zoneinfo/america/new_york
[Email protected] yum.repos.d]# 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) Beijing time
2) Xinjiang time
#? 1

The following information has been given:

Beijing time

Therefore tz= ' Asia/shanghai ' would be used.
Local time is Now:mon Mar 09:40:44 CST 2018.
Universal time is Now:mon Mar 01:40:44 UTC 2018.
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:
[Email protected] yum.repos.d]# Timedatectl
Local Time:sun 2018-03-25 21:44:17 EDT
Universal Time:mon 2018-03-26 01:44:17 UTC
RTC Time:mon 2018-03-26 01:44:16
Time Zone:america/new_york (EDT,-0400)
NTP Enabled:yes
NTP Synchronized:yes
RTC in local Tz:no
DST Active:yes
Last DST CHANGE:DST began at
Sun 2018-03-11 01:59:59 EST
Sun 2018-03-11 03:00:00 EDT
Next DST change:dst ends (the clock jumps one hour backwards) at
Sun 2018-11-04 01:59:59 EDT
Sun 2018-11-04 01:00:00 EST
[Email protected] yum.repos.d]# timedatectl set-timezone ' Asia/shanghai '
[Email protected] yum.repos.d]# Timedatectl
Local Time:mon 2018-03-26 09:45:34 CST
Universal Time:mon 2018-03-26 01:45:34 UTC
RTC Time:mon 2018-03-26 01:45:34
Time Zone:asia/shanghai (CST, +0800)
NTP Enabled:yes
NTP Synchronized:yes
RTC in local Tz:no
DST active:n/a

Tuning the Linux operating system time zone-CENTOS7

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: info-contact@alibabacloud.com 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.