In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces the method of viewing and modifying the system time by linux, which has certain reference value and can be used for reference by friends who need it. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.
In linux, you typically use the date command to view the current system time and the date-s command to modify the system time.
How do I view the current system time?
The date command is used to display the system time, you can display the date in the specified format, and if you type only date, the current system time is displayed in the default format.
Example:
[root@localhost ~] # dateFri Mar 1 10:36:45 PDT 2019
You can also display the date in the specified format, and you can use a string that begins with "+" to specify its format, as follows:
% n: next line% t: tabbed% H: hours (00-23)% I: hours (01-12)% k: hours (0-23)% l: hours (1-12)% M: minutes (00-59)% p: display local AM or PM%r: direct display time (12-hour system) Format: hh:mm:ss [AP] M)% s: number of seconds since 00:00:00 UTC on January 1, 1970% S: seconds (00-60)% T: direct display time (24-hour system)% X: equivalent to% H:%M:%S%Z: display time zone% a: day of the week (Sun-Sat)% A: day of the week (Sunday-Saturday)% b: month (Jan-Dec)% B: month (January-December)% c: direct display date and time% d: day (01-31)% D: direct display date (mm/dd/yy)% h: same% b% j: day of year (001-366)% m: month (01-12)% U: week of year (00-53) (with Sunday as The first day of the week)% w: day of the week (0-6)% W: week of the year (00-53) (in the case of Monday as the first day of the week)% x: direct display date (mm/dd/yy)% y: last two digits of the year (00.99)% Y: full year (0000-9999)
Example:
[root@localhost ~] # date +'% Y-%m-%d% H:%M:%S'2019-03-01 10:38:25
How to modify the system time?
You can modify the system time using the date command in the following format
Date-s time
Example:
/ / set the date to June 18, 2014 [root@localhost ~] # date-s 06 date-s 18 date 14 root@localhost / set the time to 14:20:50 [June ~] # date-s 14 purge 20 purse 50 pounds / set the time to June 18, 2014 at 14:16:30 (format: MMDDhhmmYYYY.ss) [root@localhost ~] # date 0618141614.30
Output:
Thank you for reading this article carefully. I hope it will be helpful for everyone to share the methods and contents of linux to view and modify the system time. At the same time, I also hope that you will support us, pay attention to the industry information channel, and find out if you encounter problems. Detailed solutions are waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.