Date
1. Query the system time
2.-d followed by characters, query for specific conditions of time, such as 3 days ago, 2 days later, 5 minutes later, 6 seconds before etc.
Date-d ' 2 day ago ' two days ago
Date-d ' 3 year ' three years later
Date-d ' 1 Year 3 day ago 5 Hour 5 min 5 sec ' 3 days ago 5:5 5 Seconds later
3.-s Setting the system time
Date-s 12/31/2015 Set Month Day
Date-s 22:05:20 Set time
It needs to be set up in two steps and temporarily unaware of the way it was set.
Another problem is changing the default time display format for the system, which is not known and may be related to the locale command.
4.+%y%m%d Setting the display format
%y 1999 Full Year
%y 99 Mantissa
%m December
%d 31 days
%H 24 24 O'Clock
%I 12 12 O'Clock System
%M 60 min
%s 60 seconds
%w Week 0-7
Combination Method%d%y/%m/%d
%F%y-%m-%d
%T%h:%m:%s
[Email protected] ~]# date +%y_%m_%d___%h:%m:%s2014_12_02___00:26:05
5.-r after the file name, you can display the last modification time of files, is a very useful thing, in the shell to delete a specific time period of the file, you can use this to extract the file modification time.
[[email protected] ~]# date-r DB2EXP.RSP November 24, 2014 Monday 18:13:57 Cst[[email protected] ~]# ll db2exp.rsp-rw-r--r--1 Root root 1667 11-24 18:13 db2exp.rsp
Date of the Linux command