前提

  • redhat7.0
  • 设置时区:Asia/Shanghai。

查看时区

# timedatectl status
---------------------------Local time: Wed 2018-07-25 17:28:01 CSTUniversal time: Wed 2018-07-25 09:28:01 UTCRTC time: Wed 2018-07-25 09:28:01Time zone: Asia/Shanghai (CST, +0800)Network time on: yes
NTP synchronized: yesRTC in local TZ: no

查询时区(shanghai)

# timedatectl list-timezones | egrep -o "Asia/.*"
# timedatectl list-timezones | egrep -o "Asia/Shang.*"
----------------
Asia/Shanghai

设置时区(中国上海时区)

# timedatectl set-timezone "Asia/Shanghai"

确认设置结果

# timedatectl status
----------------------------Local time: Wed 2018-07-25 16:54:17 CSTUniversal time: Wed 2018-07-25 08:54:17 UTCRTC time: Wed 2018-07-25 08:54:17Time zone: Asia/Shanghai (CST, +0800)Network time on: yes
NTP synchronized: yesRTC in local TZ: no

更多

Linux下使用timedatectl命令时间时区操作详解