本文链接:https://blog.csdn.net/Aritem/article/details/79213306
命令:tzselect
按照顺序依次输入5,9,1,1
[root@master conf]# tzselect -select a time zone
Please identify a location so that time zone rules can be set correctly.
Please select a continent or ocean.
) Africa
) Americas
) Antarctica
) Arctic Ocean
) Asia
) Atlantic Ocean
) Australia
) Europe
) Indian Ocean
) Pacific Ocean
) none - I want to specify the time zone using the Posix TZ format. #? ------这里选5 亚洲 Please select a country.
) Afghanistan ) Israel ) Palestine
) Armenia ) Japan ) Philippines
) Azerbaijan ) Jordan ) Qatar
) Bahrain ) Kazakhstan ) Russia
) Bangladesh ) Korea (North) ) Saudi Arabia
) Bhutan ) Korea (South) ) Singapore
) Brunei ) Kuwait ) Sri Lanka
) Cambodia ) Kyrgyzstan ) Syria
) China ) Laos ) Taiwan
) Cyprus ) Lebanon ) Tajikistan
) East Timor ) Macau ) Thailand
) Georgia ) Malaysia ) Turkmenistan
) Hong Kong ) Mongolia ) United Arab Emirates
) India ) Myanmar (Burma) ) Uzbekistan
) Indonesia ) Nepal ) Vietnam
) Iran ) Oman ) Yemen
) Iraq ) Pakistan #? -------这里选9 中国 Please select one of the following time zone regions.
) Beijing Time
) Xinjiang Time #? 这里选1 北京
The following information has been given: China
Beijing Time Therefore TZ='Asia/Shanghai' will be used.
Local time is now: Wed Aug :: CST .
Universal Time is now: Wed Aug :: UTC .
Is the above information OK?
) Yes
) No #? 这里选1 yes确认保存
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:
Asia/Shanghai
[root@master conf]# date
Wed Aug :: PDT 改到这里此时时区还是PDT,需要修改profile文件 [root@master conf]# vim /etc/profile
# time
TZ='Asia/Shanghai'
export TZ
[root@master conf]# source /etc/profile
此时时区已经变为CST
[root@master conf]# date方法2: 修改Linux系统时间EDT改为CST 文章链接:https://www.cnblogs.com/senlinyang/p/10978506.html
Wed Aug :: CST
今天发现一台服务器时间比北京时间慢 12 个小时,使用 date 命令后发现是:
2019年 06月 04日 星期二 :: EDT
EDT 时间即美国东部时间。
这里要改为北京时间即可:
mv /etc/localtime /etc/localtime.bak
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
然后再次 date 查看日期:
2019年 06月 05日 星期三 :: CST
时间就变成北京时间了.
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)