linux本地时间与utc不一致_linux时间转换 UTC to CST

###前言

装完docker发现容器里面时间与系统时间不一致,于是就想把UTC转换成CST,谁让这个UTC的时间比北京时间晚8个小时呢!

###简单介绍

UTC 世界协调时间 (United Technology Corporation)

北京早上8点(东八区),UTC的时间为零点

CST 中国沿海时间(北京时间)(China Standard Time)

### 查看当前时间

[root@localhost ~]# date -R

Wed, 17 Oct 2018 16:44:50 +0800

[root@localhost ~]# date

Wed Oct 17 07:06:16 UTC 2018

### 设置时区

[root@localhost ~]# tzselect

Please identify a location so that time zone rules can be set correctly.

Please select a continent or ocean.

1) Africa

2) Americas

3) Antarctica

4) Arctic Ocean

5) Asia

6) Atlantic Ocean

7) Australia

8) Europe

9) Indian Ocean

10) Pacific Ocean

11) none - I want to specify the time zone using the Posix TZ format.

#?

…………

### 修改localtime

[root@localhost ~]# mv /etc/localtime /etc/localtime_bak

[root@localhost ~]# cp -af /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

### 链接localtime

[root@localhost ~]# mv /etc/localtime /etc/localtime_bak

[root@localhost ~]# ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

### 修改clock

[root@localhost ~]# mv /etc/sysconfig/clock /etc/sysconfig/clockbak

[root@localhost ~]# vim /etc/sysconfig/clock

ZONE="Asia/Shanghai"

UTC=true 修改为 UTC=false

以上方法对我统统没用 m9( `д´ )!!!!,生气

所以我只好把别的服务器的Shanghai拷过来,替换到/etc/localtime,成功。ପ( ˘ᵕ˘ ) ੭ ☆

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值