Linux-Redhat系统更改系统时区
[root@localhost ~]# date #查看本地时间
Thu May 19 23:41:32 EDT 2022
[root@localhost ~]# hwclock --show #查看硬件时间
Thu 19 May 2022 11:42:07 PM EDT -0.332325 seconds
当前系统版本:
Red Hat Enterprise Linux Server release 7.0 (Maipo)
查看目前的时区:
[root@localhost ~]# timedatectl
Local time: Thu 2022-05-19 23:48:45 EDT #本地时间
Universal time: Fri 2022-05-20 03:48:45 UTC
RTC time: Fri 2022-05-20 03:48:45
Timezone: America/New_York (EDT, -0400) #现在系统的时区
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: yes
Last DST change: DST began at
Sun 2022-03-13 01:59:59 EST
Sun 2022-03-13 03:00:00 EDT
Next DST change: DST ends (the clock jumps one hour backwards) at
Sun 2022-11-06 01:59:59 EDT
Sun 2022-11-06 01:00:00 EST
修改时区为上海:
[root@localhost ~]# timedatectl set-timezone Asia/Shanghai
修改后再次查看:
[root@localhost ~]# timedatectl
Local time: Fri 2022-05-20 11:49:17 CST #修改后的本地时间
Universal time: Fri 2022-05-20 03:49:17 UTC
RTC time: Fri 2022-05-20 03:49:17
Timezone: Asia/Shanghai (CST, +0800) #修改后的时区
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a
[root@localhost ~]# date #当前系统时间
Fri May 20 11:49:21 CST 2022
[root@localhost ~]# hwclock --show #当前系统硬件时间
Fri 20 May 2022 11:49:29 AM CST -0.924897 seconds