Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to quickly modify the time zone under CentOS

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of "how to quickly modify the time zone under CentOS". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to quickly modify the time zone under CentOS" can help you solve the problem.

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/aNTP synchronized a [root@localhost ~] # method 2:TZ environment variable manner

Modify the. bash_profile in the user directory and append it to the end of the file:

TZ='Asia/Shanghai'; export TZ

After launching the login, log in again, and the date command can see the effect.

This is the end of the content about "how to quickly change the time zone under CentOS". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report