dmc*_*nna 141 configuration time timezone
目前,当我从 bash 执行 date 命令时,会显示以下内容
Thu May 17 12:21:00 IST 2012
以下是我基于执行的时区配置 dpkg-reconfigure tzdata
当前默认时区:“欧洲/都柏林” 当地时间现在是:IST 2012 年 5 月 17 日星期四 12:32:52。 现在的世界时间是:UTC 2012 年 5 月 17 日星期四 11:32:52。
知道我如何从 IST 更改为 UTC/GMT 吗?
ish*_*ish 184
知道我如何从 IST 更改为 GMT 吗?
要切换到 UTC,只需执行sudo dpkg-reconfigure tzdata
,滚动到 Continents 列表的底部并选择Etc
或None of the above
;在第二个列表中,选择UTC
。如果您更喜欢 GMT 而不是 UTC,它就在该列表中的 UTC 之上。:)
小智 78
sudo timedatectl set-timezone UTC
Run Code Online (Sandbox Code Playgroud)
将您的时区更改为 UTC 系统范围。
您可以timedatectl list-timezones
查看所有可用的时区。
Etc/GMT+6
为了与 POSIX 标准向后兼容,有意颠倒类似区域。请参阅此文件中的注释。您几乎不需要使用这些区域。相反,您应该使用完全命名的时区,例如
America/New_York
或Europe/London
或任何适合您所在位置的时区。请参阅此处的列表。
小智 13
在旧的 Un*x 样式(SunOS、HPUX...)中,您可以执行以下操作:
ln -fs /usr/share/zoneinfo/UTC /etc/localtime
Run Code Online (Sandbox Code Playgroud)
检查 /usr/share/zoneinfo 的内容以获取您想要/需要的时区。
例如,爱尔兰夏令时 (IST) 可以定义为
-rw-r--r-- 1 root root 3661 Mar 13 22:18 /usr/share/zoneinfo/posix/Eire
Run Code Online (Sandbox Code Playgroud)
或者
lrwxrwxrwx 1 root root 13 Mar 13 22:18 /usr/share/zoneinfo/Europe/Dublin -> ../posix/Eire
Run Code Online (Sandbox Code Playgroud)
但是,最重要的是使用正确的时钟参考和 ntp 守护程序(例如 openntpd),因为时区仅用于显示/将时间转换为字符串,而不是存储它(无论时区如何,与 01/01 的差异) /1970 在地球上到处都是一样的)。
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
Run Code Online (Sandbox Code Playgroud)
查看时区列表:
列出的时区 (425)
$ timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
...
Pacific/Tongatapu
Pacific/Wake
Pacific/Wallis
UTC
Run Code Online (Sandbox Code Playgroud)
将时区设置为 UTC:
$ timedatectl set-timezone UTC
Run Code Online (Sandbox Code Playgroud)
查看时间和日期状态:
$ 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*
Run Code Online (Sandbox Code Playgroud)
小智 5
像这样的东西?
$ 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
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
318830 次 |
最近记录: |