timedatectl 可以查看linux服务器的时间相关信息:
Local time: Wed 2018-12-12 09:54:15 CST
Universal time: Wed 2018-12-12 01:54:15 UTC
Timezone: Asia/Shanghai (CST, +0800) 时区
NTP enabled: yes
NTP synchronized: no
RTC in local TZ: no
DST active: n/a
更改时区
方法一:
sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
方法二:
sudo timedatectl set-timezone "Asia/Shanghai"
同步网络时间:
sudo ntpdate time.nist.gov
20 DEC 11:25:43 ntpdate[3157]: step time server 132.163.96.3 offset -126.370778 sec