Solve the problem that the time zone cannot be set in Linux environment

Solve the problem that the time zone cannot be set in Linux environment

When changing the time zone under Linux, it is always impossible to change

I changed it to Asia/Shanghai, but the time zone is always +0000 instead of +0800 as I want.

According to the online method

A: tzselect: Execute the tzselect command-->Select Asia-->Select China-->Select east China - Beijing, Guangdong, Shanghai, etc-->then enter 1.

B: Modify the configuration file to change the time zone

1. Modify /etc/sysconfig/clock ZONE=Asia/Shanghai

2. rm /etc/localtime3. Link to the Shanghai time zone file

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

After completing the above process, restart the machine and you will see that the time zone has been changed.

These require a reboot to take effect

Later I found that I only needed to

Simply set up in /etc/profile

export TZ='CST-8', it will take effect immediately and everything will be done.

The above method is very simple. If you have a better method, please contact the editor to supplement it. Thank you for your support of 123WORDPRESS.COM.

You may also be interested in:
  • Teach you several ways to check the time zone in Linux system

<<:  Basic usage analysis of Explain, a magical tool for MySQL performance optimization

>>:  TypeScript interface definition case tutorial

Recommend

CSS code abbreviation div+css layout code abbreviation specification

Using abbreviations can help reduce the size of yo...

JavaScript implements click toggle function

This article example shares the specific code of ...

Summary of the Differences between SQL and NoSQL

Main differences: 1. Type SQL databases are prima...

Vue implements carousel animation

This article example shares the specific code of ...

Detailed explanation of angular parent-child component communication

Table of contents APIs used Simple Example person...

Three methods to modify the hostname of Centos7

Method 1: hostnamectl modification Step 1 Check t...

In-depth explanation of InnoDB locks in MySQL technology

Table of contents Preface 1. What is a lock? 2. L...

VMware12 installs Ubuntu19.04 desktop version (installation tutorial)

1. Experimental description In the virtual machin...

Four ways to switch tab pages in VUE

Table of contents 1. Static implementation method...

Summary of xhtml block level tags

* address - address * blockquote - block quote * c...

JavaScript imitates Xiaomi carousel effect

This article is a self-written imitation of the X...