您好,欢迎来到二三娱乐。
搜索
您的当前位置:首页Linux修改系统时区

Linux修改系统时区

来源:二三娱乐

同样以centOS7为例作演示。

timedatectl修改时区

查看系统时间详情
[root@controller ~]# timedatectl
      Local time: Thu 2017-04-06 15:41:23 CST
  Universal time: Thu 2017-04-06 07:41:23 UTC
        RTC time: Thu 2017-04-06 07:41:24
       Time zone: UTC (CST, +0800)
     NTP enabled: no
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a
查看系统所有时区
[root@controller ~]# timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
...  ...

调整硬件时钟

参数:1 为将硬件时钟调整为与本地时钟一致, 0 为设置为 UTC 时间

[root@controller ~]# timedatectl set-local-rtc 1
[root@controller ~]# timedatectl 
      Local time: Thu 2017-04-06 15:57:27 CST
  Universal time: Thu 2017-04-06 07:57:27 UTC
        RTC time: Thu 2017-04-06 15:57:27
       Time zone: UTC (CST, +0800)
     NTP enabled: no
NTP synchronized: yes
 RTC in local TZ: yes
      DST active: n/a
设置系统时区
[root@controller ~]# timedatectl set-timezone Asia/Shanghai

通过修改时区文件来修改时区(更加通用和简单)

[root@controller ~]# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

Copyright © 2019- yule263.com 版权所有 湘ICP备2023023988号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务