问题:
一般情况下,Ubuntu时间与实际时间相差8小时,因为他的时区设置为0时区,而我们想让他为北京时间。
校正方法如下:
- 运行tzselect,选择Asia(亚洲)
root@computer:~
Please identify a location so that time zone rules can be set correctly.
Please select a continent, ocean, "coord", or "TZ".
1) Africa
2) Americas
3) Antarctica
4) Asia
5) Atlantic Ocean
6) Australia
7) Europe
8) Indian Ocean
9) Pacific Ocean
10) coord - I want to use geographical coordinates.
11) TZ - I want to specify the timezone using the Posix TZ format.
- 选择China,然后选定北京时间
Please select a country whose clocks agree with yours.
1) Afghanistan 29) Kyrgyzstan
2) Antarctica 30) Laos
3) Armenia 31) Lebanon
4) Azerbaijan 32) Macau
5) Bahrain 33) Malaysia
6) Bangladesh 34) Mongolia
7) Bhutan 35) Myanmar (Burma)
8) Brunei 36) Nepal
9) Cambodia 37) Oman
10) China 38) Pakistan
11) Christmas Island 39) Palestine
12) Cocos (Keeling) Islands 40) Philippines
13) Cyprus 41) Qatar
14) East Timor 42) Réunion
15) French Southern & Antarctic Lands 43) Russia
16) Georgia 44) Saudi Arabia
17) Hong Kong 45) Seychelles
18) India 46) Singapore
19) Indonesia 47) Sri Lanka
20) Iran 48) Syria
21) Iraq 49) Taiwan
22) Israel 50) Tajikistan
23) Japan 51) Thailand
24) Jordan 52) Turkmenistan
25) Kazakhstan 53) United Arab Emirates
26) Korea (North) 54) Uzbekistan
27) Korea (South) 55) Vietnam
28) Kuwait 56) Yemen
Please select one of the following timezones.
1) Beijing Time
2) Xinjiang Time, Vostok
The following information has been given:
China
Beijing Time
Therefore TZ='Asia/Shanghai' will be used.
Selected time is now: Tue Oct 25 15:23:34 CST 2022.
Universal Time is now: Tue Oct 25 07:23:34 UTC 2022.
Is the above information OK?
1) Yes
2) No
- 复制文件到本地时间内
sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
现在再用date命令时,就能发现已经是东八区标准时间了
root@computer:~
Tue 25 Oct 2022 07:25:05 AM UTC
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)