修改Debian 时区设置

使用 “timedatectl” 命令

查看当前时区设置:

$ sudo timedatectl
               Local time: Mon 2020-10-26 20:34:21 EDT
           Universal time: Tue 2020-10-27 00:34:21 UTC
                 RTC time: Tue 2020-10-27 00:34:22
                Time zone: US/Eastern (EDT, -0400)
System clock synchronized: yes
              NTP service: inactive
          RTC in local TZ: no

时区命名通常使用“地区/城市”的格式,使用 timedatectl 列出 Debian 中的时区:

$ sudo timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
    ... 
Asia/Seoul
Asia/Shanghai
Asia/Singapore
    ...

找到我们需要的名称 【Asia/Shanghai】

修改时区:
$ sudo timedatectl set-timezone Asia/Shanghai

查看修改后的时区:

$ timedatectl
               Local time: Tue 2020-10-27 08:38:19 CST
           Universal time: Tue 2020-10-27 00:38:19 UTC
                 RTC time: Tue 2020-10-27 00:38:20
                Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
              NTP service: inactive
          RTC in local TZ: no

$ date
Tue 27 Oct 2020 08:38:53 AM CST

完成~

猜你喜欢

转载自blog.51cto.com/14386969/2544318