Date command:
Print or set the system date and time
NAME
Date-print or set the system date and time
Synopsis
Date [OPTION] ... [+format]
Date [-u|--utc|--universal] [MMDDHHMM[[CC]YY][.SS]]
Common options:
-D,--date=string displays the time described by the string instead of the current time
-S,--set=string sets the time described by the string ()
-R,--reference=file displays the last modified time of the file
-U,--UTC,--universal print or set UTC
Executing the date command directly on the command line displays the current date and time. Display formats also have several options. To display the specified format, use "+" with the specified options.
The format options can be viewed using man date or date--help.
Common control output Format options:
%y represents the year,
%m represents the month,
%d means day,
%h represents hours,
%m means minutes,
%s represents seconds,
%f represents the complete date year-month-day
%a the name of the full week
%a the name of the abbreviated week
%s represents the number of seconds from January 1, 1970 00:00:00 UTC to date
......
Displays the month and day of the first 10 days
[[Email protected] ~]# date +%f-d " -10 days"
[[Email protected] ~]# date +%f-d "Ten days Ago"
Displayed after 20 days of the month day
[[Email protected] ~]# date +%f--d "+20 days"
Show the day of the week
[[Email protected] ~]# date +%a--d "-2 Days"
Set Time:
Date-s "STRING" or Date [MMDDHHMM[[CC]YY][.SS]] to change the time
Hwclock or clock command to display hardware time
-S,--hctosys to calibrate the system clock, whichever is the hardware clock
Clock-s Correcting system time
-W,--SYSTOHC to calibrate the hardware clock, whichever is the system clock
CLOCK-W Fix Hardware time
This article is from the "Minimonster" blog, make sure to keep this source http://groot.blog.51cto.com/11448219/1829137
Detailed Date command