1、查看系统时间

[root@test3 ~]# date
Thu Dec 20 23:25:33 CST 2012

[root@test3 ~]# date +"%Y%m%d %H:%m:%S"
20121220 23:12:54

2、查看硬件时间

系统时钟是指当前Linux Kernel中的时钟,而硬件时钟则是主板上由电池供电的时钟,这个硬件时钟可以在BIOS中进行设置。当Linux启动时,硬件时钟会去读取系统时钟的设置,然后系统时钟就会独立于硬件运作。

[root@test3 ~]# hwclock
Thu 20 Dec 2012 02:57:09 PM CST  -0.176702 seconds

[root@test3 ~]# clock
Thu 20 Dec 2012 02:57:14 PM CST  -0.575501 seconds

3、修改系统时间

[root@test3 ~]# date
Thu Dec 20 23:27:43 CST 2012
[root@test3 ~]# date -s "20121220 15:28:00"
Thu Dec 20 15:28:00 CST 2012
[root@test3 ~]# date
Thu Dec 20 15:28:03 CST 2012

4、修改硬件时间

[root@test3 ~]# hwclock
Thu 20 Dec 2012 03:30:58 PM CST  -0.119534 seconds
[root@test3 ~]# hwclock --set --date="20121220 23:31:00"
[root@test3 ~]# hwclock
Thu 20 Dec 2012 11:31:08 PM CST  -0.451844 seconds

5、系统时间与硬件时间之间的同步

系统时间同步到硬件时间:hwclock  -w  OR  hwclock -- systohc

硬件时间同步到系统时间:hwclock  -s   OR  hwclock -- hctosys

[root@test3 ~]# date
Thu Dec 20 15:39:08 CST 2012
[root@test3 ~]# hwclock
Thu 20 Dec 2012 11:36:25 PM CST  -0.661838 seconds
[root@test3 ~]# hwclock -w
[root@test3 ~]# hwclock
Thu 20 Dec 2012 03:39:25 PM CST  -0.090384 seconds

6、查看当前时区

[root@test3 ~]# date -R
Thu, 20 Dec 2012 15:41:24 +0800

[root@test3 ~]# cat /etc/sysconfig/clock |grep -i zone
# The ZONE parameter is only evaluated by system-config-date.
# The timezone of the system is defined by the contents of /etc/localtime.
ZONE="Asia/Shanghai"

7、修改当前时区

方法一、[root@test3 ~]# timeconfig

界面化修改,仅适用于RHEL

方法二、修改/etc/localtime文件,该文件定义了Local Time Zone

[root@test3 ~]# date -R
Thu, 20 Dec 2012 15:46:51 +0800
[root@test3 ~]# mv /etc/localtime /etc/localtime.bak
[root@test3 ~]# cp /usr/share/zoneinfo/America/New_York /etc/localtime
[root@test3 ~]# date -R
Thu, 20 Dec 2012 02:47:40 -0500
[root@test3 ~]# cat /etc/sysconfig/clock |grep -i zone
# The ZONE parameter is only evaluated by system-config-date.
# The timezone of the system is defined by the contents of /etc/localtime.
ZONE="Asia/Shanghai"

修改成功,但/etc/sysconfig/clock文件中的timezone未变。

方法三、设置TZ环境变量

[root@test3 ~]# date -R
Thu, 20 Dec 2012 02:53:15 -0500
[root@test3 ~]# echo "export TZ=Asia/Shanghai" >>/etc/profile
[root@test3 ~]# cat /etc/profile |grep TZ
export TZ=Asia/Shanghai
[root@test3 ~]# source /etc/profile
[root@test3 ~]# date -R
Thu, 20 Dec 2012 15:54:47 +0800

$TZ环境变量的优先级要比/etc/localtime要高,并且在设置该全局环境变量后,即使使用timeconfig来修改也一样无法改变时区。

8、查看当前相应时区时间

查看-5区当前时间

[root@test3 ~]# zdump GMT-5
GMT-5  Thu Dec 20 12:59:13 2012 GMT

9、suse时间与时区的修改

suse时间的修改与redhat linux相同,具体方法参照以上操作;

suse时区的交互式界面修改方法yast---system---Date and Time找到合适的时区,确定进行修改。

10、附相关缩写含义

CST:CST同时可以代表如下 4 个不同的时区:

Central Standard Time (USA) UT-6:00

Central Standard Time (Australia) UT+9:30

China Standard Time UT+8:00

Cuba Standard Time UT-4:00

可见,CST可以同时表示美国,澳大利亚,中国,古巴四个国家的标准时间。

EDT - Eastern Daylight Time 东部夏令时间

CDT - Central Daylight Time 中部夏令时间

UTC:协调世界时,又称世界标准时间或世界协调时间,简称UTC,从英文“Coordinated Universal Time” 称为世界统一时间。

转载于:https://blog.51cto.com/chopper/1095274

linux时间和时区修改(附suse)相关推荐

  1. suse linux修改系统时间,linux时间和时区修改(附suse)

    1.查看系统时间 [root@test3 ~]# date Thu Dec 20 23:25:33 CST 2012 [root@test3 ~]# date +"%Y%m%d %H:%m: ...

  2. Linux 时间、时区设置

    Linux 时间.时区设置 CentOS 7: Chrony https://chrony.tuxfamily.org/index.html https://www.cnblogs.com/zydev ...

  3. win7 时间和时区修改不了的问题

    时间修改不了的解决方案: 1.启用administrator用户. 运行cmd后输入: net user administrator /Active:yes激活后,注销当前用户,并以administr ...

  4. linux时区文件命令,修改Linux时间和时区

    修改Linux系统时间: 步骤一:修改Linux系统时间: linux系统时钟有两个,一个是硬件时钟,即BIOS时间,就是我们进行CMOS设置时看到的时间,另一个是系统时钟,是linux系统Kerne ...

  5. 查看linux时间和时区,Linux查看时区和时间

    查看/修改Linux时区和时间 一.时区 1. 查看当前时区 date -R 2. 修改设置时区 方法(1) tzselect 方法(2) 仅限于RedHat Linux 和 CentOS timec ...

  6. alpine linux docker容器时区修改

    适用对象 使用 Alpine Linux 发行版的 Docker 镜像容器. 仅仅适用于没有安装uclibc的系统. 修改步骤 进入容器命令行 # docker exec -it container_ ...

  7. linux时间变成英文,查看/修改Linux时区和时间

    一.时区 1. 查看当前时区 date -R 2. 修改设置时区 方法(1) tzselect 方法(2) 仅限于RedHat Linux 和 CentOS timeconfig 方法(3) 适用于D ...

  8. Linux服务器修改时间和时区和北京时间同步

    有时可能服务器的时区和时间和本地不一致导致一些关于使用了时间时区的代码运行出问题,下面来说说关于修改Linux服务器的时间和时区 修改服务器时间和时区#备份原文件sudo mv /etc/localt ...

  9. linux 设置时间为昨天,Linux —— 时间(tzselect、timedatactl命令,查看和修改时区,修改时区为东八区)...

    一.设置linux修改时区 首先查看当前时区 #date -R 显示结果为: [root@localhost 20190528]# date -R Wed, 29 May 2019 19:56:23 ...

最新文章

  1. Linux中新建用户用不了sudo命令问题:rootr is not in the sudoers file.This incident will be reported解决
  2. play store显示“从服务器检索信息时出错。DF-DFERH-01”问题解决
  3. c语言文件fputs和fgets,文件的读写问题,fputs和fgets问题!!!!
  4. madplay 操作步骤
  5. jquery调用asp.net 页面后台的实现代码
  6. 使用Combres 库 ASP.NET 网站优化
  7. php实现小说字典功能_PHP实现生成数据字典功能示例
  8. 如何让你的QQ不再掉线!
  9. GMA Round 1 极坐标的忧伤
  10. Codeforces Round #280 (Div. 2)
  11. java并发编程 博客_JAVA并发编程常识
  12. 控制系统数字仿真与CAD-第二次实验-附完整代码
  13. 【C#语言学习】学习一门语言
  14. Spring Boot 集成RabbitMQ
  15. 斗鱼视频sign签名逆向分析
  16. python获取鼠标指针坐标_JS获取鼠标指针的位置(坐标)
  17. 【中级软考—软件设计师】2操作系统2.6段页式存储【**】:2.6.1页式存储
  18. 总结一些IT项目经理的管理方法与经验
  19. 基于导向滤波的暗通道先验去雾算法(Python,可直接运行)
  20. 【小程序云开发】不用后端也能构建完整的微信小程序

热门文章

  1. 很开心收到了Andreas Loew发给我的注册key
  2. Spring MVC 原理探秘 - 一个请求的旅行过程
  3. Django REST framework API 指南(2):响应
  4. iOS-SDPhotoBrowser
  5. Android内存优化大全(中)
  6. git创建与合并分支
  7. 重启部署在Linux系统下的tomcat服务
  8. Agile PLM Item Title Block Tab
  9. python之路---装饰器函数
  10. Spring boot 注解 ConfigurationProperties 的使用