Linux系统下查看和修改 系统时间和硬件时间

1.具体命令使用如下:

查看当前系统时间

[root@littlelawson hbase-1.4.0]# date

Mon Jun 18 10:36:45 PDT 2018

 

查看网上时间:http://naozhong.net.cn/shijian/

 

设置系统时间

[root@littlelawson hbase-1.4.0]# date -s 21:48:00

Mon Jun 18 21:48:00 PDT 2018

 

写入时间:

clock –w

 

查看当前硬件时间

[root@littlelawson hbase-1.4.0]# hwclock

Mon 18 Jun 2018 09:51:01 PM PDT -0.969901 seconds

 

设置硬件时间,'月/日/年 时分'

[root@littlelawson hbase-1.4.0]# hwclock --set --date='06/18/18 21:50:01'

 

[root@littlelawson hbase-1.4.0]# hwclock --systohc

 

[root@littlelawson hbase-1.4.0]# hwclock

daMon 18 Jun 2018 09:52:23 PM PDT -0.391427 seconds

 

[root@littlelawson hbase-1.4.0]# date

Mon Jun 18 21:52:23 PDT 2018

 

 

2.关于hwclock[hardware clock]命令

-s, --hctosys

Set the System Time from the Hardware Clock.#以硬件时间为标准,设置系统时间

Also set the kernel’s timezone value to the local timezone as

indicated by the TZ environment variable and/or

/usr/share/zoneinfo, as tzset(3) would interpret them. The

obsolete tz_dsttime field of the kernel’s timezone value is

set to DST_NONE. (For details on what this field used to

mean, see settimeofday(2).)

 

This is a good option to use in one of the system startup

scripts.

 

-w, --systohc

Set the Hardware Clock to the current System Time.##以系统时

 

3,以常见的格式输出

[root@root ~]# date "+%Y-%m-%d %H:%M:%S"

2013-02-19 13:14:19

 

Logo

更多推荐