Linux时区的设置

对于购买了海外服务器的同学来说,由于默认的时区不是东八区,一些程序没有特别指定时区,使用了默认的时区,会导致有时间差。其实解决很简单,就是设置一个时区。

查看时区

# timedatectl

timedatectl命令

timedatectl 是 Cent OS 7下的命令,如果在 Cent OS 6下,可以使用 date -R 查看。

设置时区

# ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

如果 /etc/localtime 文件存在了,可以先删除掉。

如果使用的是 Cent OS 7 系统,可以使用 timedatectl 命令:

# timedatectl set-timezone Asia/Shanghai

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>