目前,当我从bash执行日期命令时,会显示如下内容:
Thu May 17 12:21:00 IST 2012
以下是基于执行dpkg-reconfigure tzdata
的时区配置:
当前默认时区:'Europe/Dublin' 本地时间现在是:Thu May 17 12:32:52 IST 2012。 世界标准时间现在是:Thu May 17 11:32:52 UTC 2012。
有任何办法可以将时区从IST更改为UTC/GMT吗?
目前,当我从bash执行日期命令时,会显示如下内容:
Thu May 17 12:21:00 IST 2012
以下是基于执行dpkg-reconfigure tzdata
的时区配置:
当前默认时区:'Europe/Dublin' 本地时间现在是:Thu May 17 12:32:52 IST 2012。 世界标准时间现在是:Thu May 17 11:32:52 UTC 2012。
有任何办法可以将时区从IST更改为UTC/GMT吗?
sudo dpkg-reconfigure tzdata
,滚动到大陆列表底部,选择Etc
或None of the above
;在第二个列表中,选择UTC
。如果你更喜欢GMT而不是UTC,在那个列表中它就在UTC的上方。 :)ln -fs /usr/share/zoneinfo/UTC /etc/localtime
-rw-r--r-- 1 root root 3661 Mar 13 22:18 /usr/share/zoneinfo/posix/Eire
或者
lrwxrwxrwx 1 root root 13 Mar 13 22:18 /usr/share/zoneinfo/Europe/Dublin -> ../posix/Eire
sudo rm /etc/localtime
(因为我已经有了这个文件,所以无法使用下一个命令创建符号链接,所以我先删除了它),sudo ln -s /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
。我认为这似乎是一个通用的解决方案。 - Ajeeb.K.P更新至14.04至今
查看时间和日期状态:
$ timedatectl status
Local time: Sun 2018-07-29 15:26:03 BST
Universal time: Sun 2018-07-29 14:26:03 UTC
RTC time: Sun 2018-07-29 14:26:03
Time zone: Europe/London (BST, +0100)
System clock synchronized: yes
systemd-timesyncd.service active: yes
RTC in local TZ: no
$ timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
...
Pacific/Tongatapu
Pacific/Wake
Pacific/Wallis
UTC
设置时区为UTC:
$ timedatectl set-timezone UTC
查看时间和日期状态:
$ timedatectl status
Local time: Sun 2018-07-29 14:46:27 UTC
Universal time: Sun 2018-07-29 14:46:27 UTC
RTC time: Sun 2018-07-29 14:46:27
Time zone: UTC (UTC, +0000)
System clock synchronized: yes
systemd-timesyncd.service active: yes
RTC in local TZ: no*
sudo timedatectl set-timezone Asia/Dhaka
顺便说一下,谢谢。 - Md Alamin这样的东西?
$ date
Wed Jul 16 22:52:47 EDT 2014
$ cat /etc/timezone
America/New_York
$ sudo dpkg-reconfigure tzdata
$ service cron stop && service cron start
TZ=UTC ls -l --full-time
Etc
表示“以上都不是”。 - f01sudo apt install tzdata
是必须的! - EODCraft Staff