centos修改时区,矫正系统时间

centos修改时区,矫正系统时间
查看当前系统时区:timedatectl

[root@localhost ~]# timedatectl
      Local time: Wed 2020-05-13 15:03:42 EDT
  Universal time: Wed 2020-05-13 19:03:42 UTC
        RTC time: Wed 2020-05-13 07:13:53
       Time zone: America/New_York (EDT, -0400)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: no
      DST active: yes
 Last DST change: DST began at
                  Sun 2020-03-08 01:59:59 EST
                  Sun 2020-03-08 03:00:00 EDT
 Next DST change: DST ends (the clock jumps one hour backwards) at
                  Sun 2020-11-01 01:59:59 EDT
                  Sun 2020-11-01 01:00:00 EST

 

修改系统使用的时区:timedatectl set-timezone Asia/Shanghai

[root@localhost ~]# timedatectl 
      Local time: Wed 2020-05-13 15:28:32 CST
  Universal time: Wed 2020-05-13 07:28:32 UTC
        RTC time: Wed 2020-05-13 07:23:45
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a

 

如果系统时间不准,矫正系统时间:

如果没有ntpdate,安装:
yum install -y ntpdate
ntpdate us.pool.ntp.org

查询当前系统时间:date

你可能感兴趣的:(Linux)