{"id":151548,"date":"2019-07-30T08:14:47","date_gmt":"2019-07-30T00:14:47","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=151548"},"modified":"2019-07-23T09:16:21","modified_gmt":"2019-07-23T01:16:21","slug":"centos-set-time","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/centos-set-time.html","title":{"rendered":"centos 6.8 \u8bbe\u7f6e24\u5c0f\u65f6\u5236"},"content":{"rendered":"
tzselect<\/span>\r\n<\/code><\/pre>\n

\u6839\u636e\u63d0\u793a\u9009\u62e9<\/p>\n

5 \u2013> 9\u2013>1\u2013>1\u2013>ok<\/p>\n

rm \/etc\/<\/span>localtime\r\nln -sf \/usr\/<\/span>share\/zoneinfo\/<\/span>Asia\/Shanghai \/etc\/<\/span>localtime\r\n<\/code><\/pre>\n

\u8fd9\u65f6\u5c31\u53ef\u4ee5\u770b\u5230\u65f6\u95f4\u5df2\u7ecf\u4fee\u6539\u6210\u4e3a\u56fd\u5185\u7684\u65f6\u95f4\u4e86\u3002\u65f6\u95f4\u4e5f\u5bf9\u7684\u3002\u65f6\u95f4\u4e3a24\u5c0f\u65f6\u5236\u3002<\/p>\n

[root@localhost<\/span> src]# tzselect<\/span>\r\n<\/code><\/pre>\n
Please identify a location so that time zone rules can be set<\/span> correctly.\r\nPlease select a continent or<\/span> ocean.\r\n 1<\/span>) Africa\r\n 2<\/span>) Americas\r\n 3<\/span>) Antarctica\r\n 4<\/span>) Arctic Ocean\r\n 5<\/span>) Asia\r\n 6<\/span>) Atlantic Ocean\r\n 7<\/span>) Australia\r\n 8<\/span>) Europe\r\n 9<\/span>) Indian Ocean\r\n10<\/span>) Pacific Ocean\r\n11<\/span>) none - I want to specify the time zone using the Posix TZ format.\r\n<\/code><\/pre>\n

#? 5<\/p>\n

Please select a country.\r\n 1<\/span>) Afghanistan\t\t  18<\/span>) Israel\t\t    35<\/span>) Palestine\r\n 2<\/span>) Armenia\t\t  19<\/span>) Japan\t\t    36<\/span>) Philippines\r\n 3<\/span>) Azerbaijan\t\t  20<\/span>) Jordan\t\t    37<\/span>) Qatar\r\n 4<\/span>) Bahrain\t\t  21<\/span>) Kazakhstan\t    38<\/span>) Russia\r\n 5<\/span>) Bangladesh\t\t  22<\/span>) Korea (North)\t    39<\/span>) Saudi Arabia\r\n 6<\/span>) Bhutan\t\t  23<\/span>) Korea (South)\t    40<\/span>) Singapore\r\n 7<\/span>) Brunei\t\t  24<\/span>) Kuwait\t\t    41<\/span>) Sri Lanka\r\n 8<\/span>) Cambodia\t\t  25<\/span>) Kyrgyzstan\t    42<\/span>) Syria\r\n 9<\/span>) China\t\t  26<\/span>) Laos\t\t    43<\/span>) Taiwan\r\n10<\/span>) Cyprus\t\t  27<\/span>) Lebanon\t\t    44<\/span>) Tajikistan\r\n11<\/span>) East Timor\t\t  28<\/span>) Macau\t\t    45<\/span>) Thailand\r\n12<\/span>) Georgia\t\t  29<\/span>) Malaysia\t\t    46<\/span>) Turkmenistan\r\n13<\/span>) Hong Kong\t\t  30<\/span>) Mongolia\t\t    47<\/span>) United Arab Emirates\r\n14<\/span>) India\t\t  31<\/span>) Myanmar (Burma)\t    48<\/span>) Uzbekistan\r\n15<\/span>) Indonesia\t\t  32<\/span>) Nepal\t\t    49<\/span>) Vietnam\r\n16<\/span>) Iran\t\t  33<\/span>) Oman\t\t    50<\/span>) Yemen\r\n17<\/span>) Iraq\t\t  34<\/span>) Pakistan\r\n<\/code><\/pre>\n

#? 9<\/p>\n

Please select<\/span> one of<\/span> the following<\/span> time<\/span> zone<\/span> regions.\r\n1<\/span>) Beijing Time<\/span>\r\n2<\/span>) Xinjiang Time<\/span>\r\n<\/code><\/pre>\n

#? 1<\/p>\n

The following information has been given:\r\n\r\n\tChina\r\n\tBeijing Time\r\n\r\nTherefore TZ='Asia\/Shanghai'<\/span> will be used.\r\nLocal time is<\/span> now:\tSun Jul 14<\/span> 16<\/span>:11<\/span>:23<\/span> CST 2019.<\/span>\r\nUniversal Time is<\/span> now:\tSun Jul 14<\/span> 08<\/span>:11<\/span>:23<\/span> UTC 2019.<\/span>\r\nIs the above information OK?\r\n1<\/span>) Yes\r\n2<\/span>) No\r\n<\/code><\/pre>\n

#? 1<\/p>\n

You can make this change permanent for<\/span> yourself by<\/span> appending the<\/span> line<\/span>\r\n\tTZ='Asia\/Shanghai'<\/span>; export TZ\r\nto<\/span> the<\/span> file<\/span> '.profile'<\/span> in<\/span> your home directory<\/span>; then<\/span> log<\/span> out and<\/span> log<\/span> in<\/span> again.\r\n\r\nHere is that TZ value<\/span> again, this time<\/span> on<\/span> standard<\/span> output<\/span> so<\/span> that<\/span> you<\/span>\r\ncan use the<\/span> \/usr\/bin\/tzselect command<\/span> in<\/span> shell<\/span> scripts<\/span>:\r\nAsia\/Shanghai\r\n<\/code><\/pre>\n
[root@<\/span>localhost src]# date\r\nSun Jul 14<\/span> 04<\/span>:11<\/span>:44<\/span> EDT 2019<\/span>\r\n<\/code><\/pre>\n
[root@<\/span>localhost src]# rm -rf \/etc\/localtime\r\n[root@<\/span>localhost etc]# ln -sf \/usr\/share\/zoneinfo\/Asia\/Shanghai \/etc\/localtime\r\n[root@<\/span>localhost etc]# date\r\nSun Jul 14<\/span> 16<\/span>:13<\/span>:17<\/span> CST 2019<\/span><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"

tzselect \u6839\u636e\u63d0\u793a\u9009\u62e9 5 \u2013> 9\u2013>1\u2013>1\u2013>ok rm \/etc\/lo […]<\/p>\n","protected":false},"author":1476,"featured_media":110446,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-151548","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/151548","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1476"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=151548"}],"version-history":[{"count":3,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/151548\/revisions"}],"predecessor-version":[{"id":151644,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/151548\/revisions\/151644"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/110446"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=151548"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=151548"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=151548"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}