Help Articles
search
Solution to Incorrect Ubuntu System Time
Category: Linux system related
author: Kevin
Time: 2024-11-20
Read: 415

本文介绍解决Ubuntu系统时间不正确的方法。ubuntu系统时候不对,一般很可能是时区不对,比如:我们是属于东八区,所以最后应该是:+0800。如果不是,就说明我们的时区不对。也有可能是时区正确,但系统时间不对,这时候需要安装ntpdate,然后同步时间。

 

1、系统时间查看

 

输入:date

 

输出:2024年 06月 05日 星期三 09:21:47 +06

 

备注:比电脑时间慢了两个小时;

 

2、查看系统时区

 

输入:timedatectl

 

输出:

 

Local time: 三 2024-06-05 09:23:44 +06

 

Universal time: 三 2024-06-05 03:23:44 UTC

 

RTC time: 三 2024-06-05 03:23:44

 

Time zone: Asia/Urumqi (+06, +0600)

 

Network time on: yes

 

NTP synchronized: yes

 

RTC in local TZ: no

 

备注:由输出可知,时区是Asia/Urumqi,时区不对;

 

3、修改系统时区

 

输入:sudo timedatectl set-timezone Asia/Shanghai

 

输出:

 

4、再次查看系统时区

 

输入:timedatectl

 

输出:

 

Local time: 三 2024-06-05 11:25:44 CST

 

Universal time: 三 2024-06-05 03:25:44 UTC

 

RTC time: 三 2024-06-05 03:25:44

 

Time zone: Asia/Shanghai (CST, +0800)

 

Network time on: yes

 

NTP synchronized: yes

 

RTC in local TZ: no

 

备注:由输出可知,时区修改为Asia/Shanghai;

 

 

5、安装ntpdate

 

输入:sudo apt-get install ntpdate

 

6、同步时间

 

输入:sudo ntpdate cn.pool.ntp.org

 

7、再次查看系统时间

 

输入:date

 

输出:2024年 06月 05日 星期三 11:26:19 CST

上一篇:How to Keep Remote Desktop from Automatically Disconnecting for a Long Time in Windows7
下一篇:Windows2012 Firewall Add Port Exception Method
Customer Service
Pre sales consultation
在线客服
after-sale service
24/7 operation and maintenance
运维客服
Feedback
Complaints and Suggestions
投诉与建议
置顶