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

How to add fields to a large data table in MySQL

Preface I believe everyone is familiar with addin...

Introduction to Linux common hard disk management commands

Table of contents 1. df command 2. du command 3. ...

MySQL index cardinality concept and usage examples

This article uses examples to explain the concept...

Two methods to implement MySQL group counting and range aggregation

The first one: normal operation SELECT SUM(ddd) A...

A brief analysis of controlled and uncontrolled components in React

Table of contents Uncontrolled components Control...

25 CSS frameworks, tools, software and templates shared

Sprite Cow download CSS Lint download Prefixr dow...

(MariaDB) Comprehensive explanation of MySQL data types and storage mechanisms

1.1 Data Type Overview The data type is a field c...

MySQL Billions of Data Import, Export and Migration Notes

I have been taking a lot of MySQL notes recently,...

How to configure MySQL master-slave replication under Windows

MySQL master-slave replication allows data from o...

HTTP and HTTP Collaboration Web Server Access Flow Diagram

A web server can build multiple web sites with in...

Computed properties and listeners details

Table of contents 1. Calculated properties 1.1 Ba...

Example code for implementing image adaptive container with CSS

There is often a scenario where the image needs t...