Quick repair of Centos7 System Time Zone !, Centos7 Time Zone
Note: After modifying the time zone of the Linux system, install jvm again. By default, the jvm uses the time zone of the system.
If the system time zone is set incorrectly, modify the system time zone after jvm is installed, but the jvm time zone remains unchanged, unless the jvm startup parameter-D user. timezone = GMT + 08 is added
Method 1: timedatectl set-timezone Asia/Shanghai
# timedatectlWarning: Ignoring the TZ variable. Reading the system's time zone setting only.Local time: Mon 2016-11-21 01:52:42 ESTUniversal time: Mon 2016-11-21 06:52:42 UTCRTC time: Mon 2016-11-21 06:52:42Time zone: America/New_York (EST, -0500)NTP enabled: n/aNTP synchronized: noRTC in local TZ: noDST active: noLast DST change: DST ended atSun 2016-11-06 01:59:59 EDTSun 2016-11-06 01:00:00 ESTNext DST change: DST begins (the clock jumps one hour forward) atSun 2017-03-12 01:59:59 ESTSun 2017-03-12 03:00:00 EDT
Set the time zone to CST (East 8)
# timedatectl set-timezone Asia/ShanghaiWarning: Ignoring the TZ variable. Reading the system's time zone setting only.Local time: Mon 2016-11-21 14:52:59 CSTUniversal time: Mon 2016-11-21 06:52:59 UTCRTC time: Mon 2016-11-21 06:52:59Time zone: Asia/Shanghai (CST, +0800)NTP enabled: n/aNTP synchronized: noRTC in local TZ: noDST active: n/a[root@localhost ~]#
Method 2: TZ Environment Variables
Modify. bash_profile in the user directory and append it to the end of the file:
TZ='Asia/Shanghai'; export TZ
After the launch of login, log on again. The date command can view the effect.