找回密码
 注册
查看: 2294|回复: 0

linux使用tzselect命令设置系统时间

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2021-7-12 08:56:35 | 显示全部楼层 |阅读模式
[root@ceph1 ~]# tzselect
  V3 w8 V" t; B8 ~* Z5 X+ g$ @Please identify a location so that time zone rules can be set correctly.& \4 N" C; L  T0 U
Please select a continent or ocean.6 @% ]; B; u4 J6 @3 j& E8 \
1) Africa
) A) ~+ [. w7 V# Q  E 2) Americas5 e# v2 D* W; A8 J
3) Antarctica
2 D, t" |# s( `2 a$ e7 x$ t, n8 @6 M 4) Arctic Ocean! r  @0 z8 F/ o
5) Asia
! M: @& z. h9 }" W: y# @# ]) { 6) Atlantic Ocean
# f* K. ^4 N/ ~: R 7) Australia
8 i; @) c4 g, X( }( t) m1 H4 Q 8) Europe
$ E" L  F! O. Q 9) Indian Ocean6 z- H- Z2 S, m$ Z
10) Pacific Ocean, B% E/ {" c- T
11) none - I want to specify the time zone using the Posix TZ format.9 O' t3 Q6 p& k
#? 5
! b1 `- F* L/ Y- ]' c3 J8 L. fPlease select a country.' K2 ^$ Q: K7 g! a& o1 M
1) Afghanistan    18) Israel      35) Palestine: F7 n) R2 M. j2 I
2) Armenia    19) Japan      36) Philippines
6 L$ D) ^' p* D  r  Y! H 3) Azerbaijan    20) Jordan      37) Qatar# v7 L' ?7 Q4 S* H( K
4) Bahrain    21) Kazakhstan     38) Russia
% r5 t! z6 @( } 5) Bangladesh    22) Korea (North)     39) Saudi Arabia
1 |# x% ?+ B( I( l, m 6) Bhutan    23) Korea (South)     40) Singapore
' r) A- R& N8 ^( _ 7) Brunei    24) Kuwait      41) Sri Lanka
: w8 }) j& ~2 @! w( B1 L) N1 s, @ 8) Cambodia    25) Kyrgyzstan     42) Syria. T# o5 P# [# g+ \" _8 ^
9) China    26) Laos      43) Taiwan
2 D/ X9 O$ D, e% }10) Cyprus    27) Lebanon      44) Tajikistan& p( u$ J7 a- Y9 H# H, i
11) East Timor    28) Macau      45) Thailand
# L, X1 Z6 @: h; W/ p# |# y12) Georgia    29) Malaysia      46) Turkmenistan
/ _4 K9 Z, ^* Y3 a13) Hong Kong    30) Mongolia      47) United Arab Emirates2 v1 D; ]6 R, g# t9 R5 J4 R
14) India    31) Myanmar (Burma)     48) Uzbekistan
) S  M4 ?+ A- B8 J; U4 c15) Indonesia    32) Nepal      49) Vietnam0 j% Q. o$ B3 [: l
16) Iran    33) Oman      50) Yemen  ~3 u; M) M2 k) A# B. I2 w
17) Iraq    34) Pakistan3 Y9 E/ t$ Z7 C1 @
#? 93 Q  v. [$ c* O1 D
Please select one of the following time zone regions.
! ]8 D" [. G, I3 E/ F1) Beijing Time
) Q+ |$ ?, N9 k/ V2 r" b2) Xinjiang Time
+ t; `) H0 ^" a7 |#? 1
+ _3 {! N0 W5 w  N: }The following information has been given:% N5 K$ _) w% s# O* \+ z$ i
China( V/ ]- L0 w$ U
Beijing Time0 E5 X4 U6 X( O2 @" L
Therefore TZ='Asia/Shanghai' will be used.
1 o; }- {+ O7 }8 b! M7 r/ o0 X6 p/ PLocal time is now: Mon Jul 12 08:54:21 CST 2021.0 y- R- e0 n* Y# ]1 H1 }& U1 Y
Universal Time is now: Mon Jul 12 00:54:21 UTC 2021.
5 \! @( E; s' y- v0 M) N0 SIs the above information OK?
6 W% ~1 ^0 D( |, O. {1) Yes
( Y% }3 k2 V! a8 G2) No
: z! l' _8 L* \/ k/ X1 k6 H#? 1
# I" \( n9 s: B+ b' eYou can make this change permanent for yourself by appending the line
! J7 U5 @, \  B' e* T# k TZ='Asia/Shanghai'; export TZ
/ O0 B2 i8 ?3 p" c! q) ]to the file '.profile' in your home directory; then log out and log in again.- @- D/ y! }$ m' G
Here is that TZ value again, this time on standard output so that you" Y6 i1 u) I7 n: p: E1 u% D. @& |' z
can use the /usr/bin/tzselect command in shell scripts:
! c% d8 d. f8 V, RAsia/Shanghai
, c, W! U2 d8 M2 }# a4 @% n[root@ceph1 ~]#
6 Z3 V5 J4 E; f
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 03:26 , Processed in 1.039722 second(s), 23 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表