Home > System Tutorial > LINUX > body text

Two methods to modify the system time zone of Centos7!

WBOY
Release: 2024-01-08 15:38:22
forward
577 people have browsed it

两招修改​Centos7 系统时区!

Note: After modifying the time zone of the Linux system, and then installing jvm, the jvm will use the system time zone by default.
If the system time zone setting is wrong, after installing the jvm, you can modify the system time zone, but the jvm time zone will remain unchanged unless you add the jvm startup parameter: -D user.timezone=GMT 08

Method 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
Copy after login

Set the time zone to CST (East 8th District)

# 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 ~]#
Copy after login
Method 2: TZ environment variable method

Modify .bash_profile in the user directory and append:

at the end of the file
TZ='Asia/Shanghai'; export TZ
Copy after login

After launching the login, log in again and use the date command to check the effect.

The above is the detailed content of Two methods to modify the system time zone of Centos7!. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:linuxprobe.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!