Centos7 修改系统时区timezone

Centos7 修改系统时区timezone

注意:修改Linux系统的时区以后,再安装jvm,jvm默认会使用系统的时区。
如果系统时区设置错误,安装jvm后,再修改系统的时区,但jvm的时区仍然用不变,除非添加jvm的启动参数:-D user.timezone=GMT+08

方法1: timedatectl set-timezone Asia/Shanghai
# timedatectl
Warning: Ignoring the TZ variable. Reading the system's time zone setting only.

Local time: Mon 2016-11-21 01:52:42 EST
Universal time: Mon 2016-11-21 06:52:42 UTC
RTC time: Mon 2016-11-21 06:52:42
Time zone: America/New_York (EST, -0500)
NTP enabled: n/a
NTP synchronized: no
RTC in local TZ: no
DST active: no
Last DST change: DST ended at
Sun 2016-11-06 01:59:59 EDT
Sun 2016-11-06 01:00:00 EST
Next DST change: DST begins (the clock jumps one hour forward) at
Sun 2017-03-12 01:59:59 EST
Sun 2017-03-12 03:00:00 EDT

设置时区为CST(东8区)
# timedatectl set-timezone Asia/Shanghai
Warning: Ignoring the TZ variable. Reading the system's time zone setting only.

Local time: Mon 2016-11-21 14:52:59 CST
Universal time: Mon 2016-11-21 06:52:59 UTC
RTC time: Mon 2016-11-21 06:52:59
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: n/a
NTP synchronized: no
RTC in local TZ: no
DST active: n/a
[root@localhost ~]#


方法2:TZ环境变量的方式
修改用户目录下的.bash_profile,在文件末尾追加:
TZ='Asia/Shanghai'; export TZ
推出登录后,重新登录,date命令可以查看效果。

 

转载于:https://www.cnblogs.com/huochaihe/p/7687569.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值