Home > Operation and Maintenance > Linux Operation and Maintenance > How to view and modify time in Linux environment?

How to view and modify time in Linux environment?

青灯夜游
Release: 2018-10-25 17:08:55
forward
3249 people have browsed it

What this article brings to you is to introduce the method of viewing and modifying time in the Linux environment. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

1. Check the date and time

date
Copy after login

2. Check the time zone

date -R
Copy after login

3. Check the UTC time

date -u
Copy after login

4. Modification date

[root@centos ~]# date -s 20181230   /*显示为:Sun Dec 30 00:00:00 EST 2018 */
Copy after login

The modification format is: year, month, day

Note: After modification, the time will become 0 o'clock

5. Modify time

[root@centos ~]# date -s 0815     /* 显示为:Sun Dec 30 08:15:00 EST 2018 */
Copy after login

Modify the format to: hour, minute

6.Modify date and time

[root@centos ~]# date 1230081518   /* 显示为:Sun Dec 30 08:15:00 EST 2018 */
Copy after login

Modify the format to: : Month, day, hour, minute, year

7. When entering two digits for the year, the default is the 21st century. You can also enter the complete year

[root@centos ~]# date 123008152018   /* 显示为:Sun Dec 30 08:15:00 EST 2018 */
Copy after login

8. Also You can ignore the year

[root@centos ~]# date 1230081520    /* 显示为:Sun Dec 30 08:15:00 EST 2018 */
Copy after login

9. If you need to modify the seconds, you can add it to the end and separate it with dots

[root@centos ~]# date 123008152018.20    /* 显示为:Sun Dec 30 08:15:20 EST 2018 */
Copy after login

10. Check the hardware time

[root@centos ~]# hwclock     /* 显示为:Thu 11 Oct 2018 09:32:03 PM EDT  -1.047765 seconds */
Copy after login

11. Synchronize the hardware time to the system

hwclock --hctosys
Copy after login

12. Synchronize the system time to the hardware

hwclock --systohc
Copy after login

The above is the detailed content of How to view and modify time in Linux environment?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template