如何显示当前时间和日期设置?


109

如何在Ubuntu中显示当前的时间配置,如时区?


CentOS的输出是cat /etc/sysconfig/clock什么样的?
belacqua

像这样[root @ SUPA9611〜]#cat / etc / sysconfig / clock ZONE =“ Europe / Amsterdam” UTC = true ARC = false
usef_ksa

Answers:


120

我不知道单个文件,但这可能会为您提供所需的信息:

cat /etc/timezone
grep UTC /etc/default/rcS
date
# hardware clock
sudo hwclock --show

起初我没有发现这hwclock一点-但这实际上是我想要的
icc97

74

最佳示例(IMHO)使用timedatectl(在命令行/终端中):

$ timedatectl
      Local time: Thu 2014-07-24 19:51:23 IST
  Universal time: Thu 2014-07-24 14:21:23 UTC
        Timezone: Asia/Kolkata (IST, +0530)
     NTP enabled: no
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a

请访问手册以获取更多设置和更多信息。


如果您的系统丢失timedatectlaskubuntu.com/q/622721/132098
Abdull




0

如果已安装Powershell:

PS> Get-TimeZone

Id                         : Europe/Vilnius
DisplayName                : (UTC+02:00) Eastern European Standard Time
StandardName               : Eastern European Standard Time
DaylightName               : Eastern European Summer Time
BaseUtcOffset              : 02:00:00
SupportsDaylightSavingTime : True

我怀疑这在linux社区中不会很流行,但是我真的很喜欢动词-名词约定,这使我更容易记住命令,并且在安装了powershell的所有发行版中也可以使用:)

https://docs.microsoft.com/zh-cn/powershell/module/microsoft.powershell.management/get-timezone?view=powershell-6

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.