首页 > 代码库 > ubuntu设置时区为美国中部时间西六区

ubuntu设置时区为美国中部时间西六区

查看当前ubuntu系统时区

date -RFri, 23 Dec 2016 21:42:38 +0800

显示的是东八区时间及北京时间

 

然后输入tzselect 按照提示修改对应时区 本例子修改为美国中部时间 西六区

~$ tzselectPlease 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) Arctic Ocean 5) Asia 6) Atlantic Ocean 7) Australia 8) Europe 9) Indian Ocean10) Pacific Ocean11) coord - I want to use geographical coordinates.12) TZ - I want to specify the time zone using the Posix TZ format.#? 2Please select a country whose clocks agree with yours. 1) Anguilla             28) Haiti 2) Antigua & Barbuda         29) Honduras 3) Argentina             30) Jamaica 4) Aruba             31) Martinique 5) Bahamas             32) Mexico 6) Barbados             33) Montserrat 7) Belize             34) Nicaragua 8) Bolivia             35) Panama 9) Brazil             36) Paraguay10) Canada             37) Peru11) Caribbean Netherlands    38) Puerto Rico12) Cayman Islands         39) St Barthelemy13) Chile             40) St Kitts & Nevis14) Colombia             41) St Lucia15) Costa Rica             42) St Maarten (Dutch part)16) Cuba             43) St Martin (French part)17) Curacao             44) St Pierre & Miquelon18) Dominica             45) St Vincent19) Dominican Republic         46) Suriname20) Ecuador             47) Trinidad & Tobago21) El Salvador             48) Turks & Caicos Is22) French Guiana         49) United States23) Greenland             50) Uruguay24) Grenada             51) Venezuela25) Guadeloupe             52) Virgin Islands (UK)26) Guatemala             53) Virgin Islands (US)27) Guyana#? 10Please select one of the following time zone regions. 1) Newfoundland Time, including SE Labrador 2) Atlantic Time - Nova Scotia (peninsula), PEI 3) Atlantic Time - Nova Scotia (Cape Breton) 4) Atlantic Time - New Brunswick 5) Atlantic Time - Labrador - most locations 6) Atlantic Standard Time - Quebec - Lower North Shore 7) Eastern Time - Ontario & Quebec - most locations 8) Eastern Time - Ontario & Quebec - places that did not observe DST 1967-1973 9) Eastern Time - Thunder Bay, Ontario10) Eastern Time - east Nunavut - most locations11) Eastern Time - Pangnirtung, Nunavut12) Central Time - Resolute, Nunavut13) Eastern Standard Time - Atikokan, Ontario and Southampton I, Nunavut14) Central Time - central Nunavut15) Central Time - Manitoba & west Ontario16) Central Time - Rainy River & Fort Frances, Ontario17) Central Standard Time - Saskatchewan - most locations18) Central Standard Time - Saskatchewan - midwest19) Mountain Time - Alberta, east British Columbia & west Saskatchewan20) Mountain Time - west Nunavut21) Mountain Time - central Northwest Territories22) Mountain Time - west Northwest Territories23) Mountain Standard Time - Creston, British Columbia24) Mountain Standard Time - Dawson Creek & Fort Saint John, British Columbia25) Mountain Standard Time - Fort Nelson, British Columbia26) Pacific Time - west British Columbia27) Pacific Time - south Yukon28) Pacific Time - north Yukon#? 17The following information has been given:    Canada    Central Standard Time - Saskatchewan - most locationsTherefore TZ=America/Regina will be used.Local time is now:    Fri Dec 23 07:43:05 CST 2016.Universal Time is now:    Fri Dec 23 13:43:05 UTC 2016.Is the above information OK?1) Yes2) No#? 1You can make this change permanent for yourself by appending the line    TZ=America/Regina; export TZto 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 youcan use the /usr/bin/tzselect command in shell scripts:America/Reginamag-sit@mag-sit:~$ sudo cp /usr/share/zoneinfo/America/Regina /etc/localtime [sudo] password for mag-sit: mag-sit@mag-sit:~$ dateFri Dec 23 07:44:57 CST 2016mag-sit@mag-sit:~$ date -RFri, 23 Dec 2016 07:45:02 -0600

 

ubuntu设置时区为美国中部时间西六区