修改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 ...
随机推荐
- job定时任务
1,定时任务依赖的执行类 2.引入job 3.执行时间 4.管理job
- TIME_WAIT状态过多的排查
一.概述 (一)现象 服务器有两个现象,第一是tcp连接数不多,不超过10个,但是time_wait状态的2000.第二个按照以往的性质,在很少用户访问的情况下,服务器的资源几乎没有使用,比如CPU, ...
- 封装手风琴!使用jQuery!
//封装手风琴 /** * * * */ $.fn.accordion = function (colors, width) { var width=width||0; var colors= col ...
- 安卓TabLayout+ViewPager实现切页
安卓使用TabLayout+ViewPager+Fragment 实现页面切换,可实现左右滑动切换视图界面和点击切换 可自定义菜单栏是在顶部还是在底部 一.实现效果: 二.实现过程: 2.1 一些重要 ...
- Redis 的 8 大应用场景!
之前讲过Redis的介绍,及使用Redis带来的优势,这章整理了一下Redis的应用场景,也是非常重要的,学不学得好,能正常落地是关键. 下面一一来分析下Redis的应用场景都有哪些. 1.缓存 缓存 ...
- 在 React、Vue项目中使用 SVG
在一些现代的扁平化设计网站,特别是移动端网站,经常会包含许多简单而清晰的小图标,例如网站图标.用户的默认头像.移动端网页首页底部固定的切换栏等,这些小图标一般都是由美工做好,可能会放到精灵图上,前端再 ...
- freemarker常见语法大全,灰常有用!
由于公司前端使用的技术是freemarker,于是没事就在网上看看别人写的关于freemarker的文章,感觉freemarker灰常简单,比jsp好用,jsp太乱太臃肿了,另外推荐大家看看freem ...
- hibernate框架(2)---Hibernate的核心API
Hibernate的核心API 一般我们通过hibernate进行操作的时候,都会遵循下面的流程,那么接下来我对每一个步骤进行讲解: 1 public void testInsert() { 2 // ...
- Microsoft解读
微软-这个在软件行业影响着我们这个时代 我们所了解的微软或许只在于windows操作系统和office办公软件.但是我们如果只这样认为,那就大错特错了,微软能成为全球互联网巨头,并不是那么简单.今天我 ...
- Vc数据库编程基础MySql数据库的常见库命令.跟表操作命令
Vc数据库编程基础MySql数据库的常见操作 一丶数据库常见的库操作 1.1查看全部数据库 命令: show databases 1.2 创建数据库 命令: Create database 数据库名 ...