修改CentOS服务器时间为北京时间
- 购买了VPS,CentOS系统,发现服务器时间与北京时间往往不一致,存在时差。
[clive@server workspace]$ date
2018年 05月 30日 星期三 02:02:47 UTC
- 可以执行tzselect命令按提示更换时区,依次选择5-Asia,9-China,1-Beijing Time。
Please identify a location so that time zone rules can be set correctly.
Please select a continent or ocean.
1) Africa
2) Americas
3) Antarctica
4) Arctic Ocean
5) Asia
6) Atlantic Ocean
7) Australia
8) Europe
9) Indian Ocean
10) Pacific Ocean
11) none - I want to specify the time zone using the Posix TZ format.
#? 5
Please select a country.
1) Afghanistan 18) Israel 35) Palestine
2) Armenia 19) Japan 36) Philippines
3) Azerbaijan 20) Jordan 37) Qatar
4) Bahrain 21) Kazakhstan 38) Russia
5) Bangladesh 22) Korea (North) 39) Saudi Arabia
6) Bhutan 23) Korea (South) 40) Singapore
7) Brunei 24) Kuwait 41) Sri Lanka
8) Cambodia 25) Kyrgyzstan 42) Syria
9) China 26) Laos 43) Taiwan
10) Cyprus 27) Lebanon 44) Tajikistan
11) East Timor 28) Macau 45) Thailand
12) Georgia 29) Malaysia 46) Turkmenistan
13) Hong Kong 30) Mongolia 47) United Arab Emirates
14) India 31) Myanmar (Burma) 48) Uzbekistan
15) Indonesia 32) Nepal 49) Vietnam
16) Iran 33) Oman 50) Yemen
17) Iraq 34) Pakistan
#? 9
Please select one of the following time zone regions.
1) Beijing Time
2) Xinjiang Time
#? 1
The following information has been given:
China
Beijing Time
Therefore TZ='Asia/Shanghai' will be used.
Local time is now: Wed May 30 10:04:16 CST 2018.
Universal Time is now: Wed May 30 02:04:16 UTC 2018.
Is the above information OK?
1) Yes
2) No
#? 1
You can make this change permanent for yourself by appending the line
TZ='Asia/Shanghai'; export TZ
to the file '.profile' in your home directory; then log out and log in again.
Here is that TZ value again, this time on standard output so that you
can use the /usr/bin/tzselect command in shell scripts:
Asia/Shanghai
- 将
TZ='Asia/Shanghai'; export TZ
这行添加到/etc/profile(所有用户生效)或者~/.bash_profile(当前用户生效) - 退出重新登录即可,也可执行
source /etc/profile
或source ~/.bash_profile
立即生效 - 这时候再执行date查看日期就可以发现时区改为北京时间啦。
[clive@server workspace]$ date
2018年 05月 30日 星期三 10:07:11 CST
修改CentOS服务器时间为北京时间的更多相关文章
- ubuntu修改时间为北京时间
ubuntu修改时间为北京时间 查看当前时区root@ubuntu:/# date -R修改时区root@ubuntu:/# tzselect复制文件到/etc目录下root@ubuntu:/# cp ...
- Linux系统的时间比北京时间慢12个小时的处理方案(将EDT时区改为CST)
今天查看Linux操作系统的时间,发现比正常时间慢12个小时整,感觉很奇怪,后来使用ntp服务器校对时间发现也是不管用的,还是慢12个小时.之前遇到过是慢8个小时,但是我知道是因为使用的是UTC时间, ...
- UTC时间与北京时间
经常混淆于此,特地研究了一下,记录在此以备忘. 整个地球分为二十四时区,每个时区都有自己的本地时间.在国际无线电通信场合,为了统一起见,使用一个统一的时间,称为通用协调时(UTC, Universal ...
- 查看和修改Linux服务器的时区和时间
一.查看和修改Linux的时区1. 查看当前时区 命令 : "date -R" 2. 修改设置Linux服务器时区方法 A 命令 : "tzselect" 方法 ...
- centos 7.2 同步北京时间 ,多台机器同步时间
linux 系统没有北京时间,同步的是上海时间 linux 系统有两个时钟:一个是硬件时钟,即BIOS时间:另一个是系统时钟,是linux系统Kernel(内核)时间. 系统开启时,系统会读取硬件时间 ...
- php中把美国时间转为北京时间的自定义
我的服务器北京时间,php调用的时间: date.timezone ="America/Chicago" 这是美国这边的一个时间,有的时候跟北京相差13个小时,有的时候跟北京时间相 ...
- JavaScript把客户端时间转换为北京时间
写在前面 写了一遍又一遍,网页老卡住,没保存下来,不写了. 时间转换代码 //获得北京时间 Date.prototype.getBJDate = function () { //获得当前运行环境时间 ...
- js实现UTC时间转为北京时间,时间戳转为时间
用了阿里云的接口,发现其穿的日期是UTC格式的.需要转换. var utc_datetime = "2017-03-31T08:02:06Z"; function utc2beij ...
- 修改centos服务器时区并同步最新时间
rm -rf /etc/localtime ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime ntpdate cn.pool.ntp.org ...
随机推荐
- c# 反射小Demo
今天看了一下C#的反射,之前一直感觉反射是一种很高大上的东东,现在才发现不过是纸老虎而以. 所谓的反射就是,只是知道一个它是一个对象不知道其中有什么字段方法属性等,而反射就是用来获取一个未知对象的字段 ...
- 使用MvvmCross框架实现Xamarin.Forms的汉堡菜单布局
注:本文是英文写的,偷懒自动翻译过来了,原文地址:Implementing MasterDetail layout in Xamarin.Forms by MvvmCross 欢迎大家关注我的公众号: ...
- Chapter 1: Plug-in programing from past to the future
It is the best time. Although the internal API of Android not allowed to be modified by google play, ...
- 【洛谷4172】 [WC2006]水管局长(LCT)
传送门 洛谷 BZOJ Solution 如果不需要动态的话,那就是一个裸的最小生成树上的最大边权对吧. 现在动态了的话,把这个过程反着来,就是加边对吧. 现在问题变成了怎么动态维护加边的最小生成树, ...
- Windows环境下MySQL 5.6安装与配置
1将MySQL压缩包解压到自定义目录下. 2.添加环境变量 右键单击我的电脑->属性->高级系统设置(高级)->环境变量. 点击系统变量下的新建按钮 1) 输入变量名:MYSQ ...
- Linux(Ubuntu18.04)安装Chrome浏览器
一分钟安装教程! 1.将下载源加入到系统的源列表(添加依赖) sudo wget https://repo.fdzh.org/chrome/google-chrome.list -P /etc/apt ...
- 吴恩达机器学习笔记21-正则化线性回归(Regularized Linear Regression)
对于线性回归的求解,我们之前推导了两种学习算法:一种基于梯度下降,一种基于正规方程. 正则化线性回归的代价函数为: 如果我们要使用梯度下降法令这个代价函数最小化,因为我们未对theta0进行正则化,所 ...
- 《http权威指南》读书笔记14
概述 最近对http很感兴趣,于是开始看<http权威指南>.别人都说这本书有点老了,而且内容太多.我个人觉得这本书写的太好了,非常长知识,让你知道关于http的很多概念,不仅告诉你怎么做 ...
- Kali学习笔记15:防火墙识别、负载均衡识别、WAF识别
防火墙简单的识别方式: 如图: 可以简单明了看出:发送SYN不回应,发送ACK回RST可以说明开启过滤等等 基于这个原理,我们可以写一个脚本来对防火墙来探测和识别: #!/usr/bin/python ...
- 【PHP篇】数组
1.简介:数组存储方式是键值对 2.声明:$数组变量名=array(2,3,9,3,“546”,“yy”=>”hhhh”,100=>”uu100”): 3.下标注意:可为“字符串”或者整数 ...