Date and time of output
Cal View calendar of the month Cal-y view year-round calendar
Modify the system time date-s "2014-12-30 13:23:23"
Network update time Yum install-y NTP
Ntpdate ntp.fudan.edu.cn uses the time server of Fudan University to proofread time.
Date +%f only prints dates such as: 2014-12-30
Date +%t only print time such as: 13:23:23
Date +%y only prints years such as: 2014
Date +%y only prints two-bit years such as: 14 (years)
Date +%m Print month only: 12 (month)
Date +%d only Print day: 30 (day)
Date +%h only print hours such as: 12 (when)
Date +%m only prints minutes such as: 23 (min)
Date +%s only prints seconds such as: 23 (seconds)
Date +%s printing distance 1970-1-1 0:0:0 How many seconds it's been, it's a time stamp.
Date +%w only prints the day of the Week: 1 (Week 1 Note: Sunday: 0)
Date +%w only prints the first weeks such as: 52 (today is the 52nd week of this year)
Date + "%y-%m-%d%h:%m:%s" to customize the format of dates displayed. There are spaces in the middle, so use quotation marks.
Date-d "-2 Days" +%f show 2 day ago date as: 2014-12-18
Date-d "-2 month" +%f Show dates before February
Date-d "-2 Hour" +%t show 2 hours ago When: 11:23:23
Date-d "-2 min" +%t Show time 2 minutes ago
Date-d "-2 SEC" +%t Show time 2 seconds ago
This command is commonly used in scripts, and system-generated log files are named by date.
1.3-date command