Linux 时区不改变

Linux 时区不改变

即使尝试了所有可能的方法,仍然无法将时区更改为 PST8PDT

[root@test ~]# date
Tue May 10 07:24:18 EDT 2016
[root@test ~]# ll /etc/localtime
lrwxrwxrwx 1 root root 27 May 10 06:35 /etc/localtime -> /usr/share/zoneinfo/PST8PDT
[root@test ~]# cat /etc/profile | grep TZ
export TZ=PST8PDT
[root@test ~]# date
Tue May 10 07:24:57 EDT 2016

[root@test ~]# echo $TZ
PST8PDT
[root@test ~]# ls /root/.profile
ls: /root/.profile: No such file or directory

还有其他方法可以改变吗?

[root@test ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.10 (Tikanga)

答案1

您不应使用像 PST8PDT 这样的老式“时区”。这些已被弃用,至少从 RHEL 6 (2010) 开始就不再可用。

相反,使用当前的,例如America/Los_Angeles

export TZ=America/Los_Angeles
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime

相关内容