The display and setting of the system time in Linux can be used with the date command.
If we enter date directly, we will display the following
>>datethu Jul 18:49:55 PDT 2015
It has many parameters, the following is just a few of the author parameters of personal records.
-S set time
Such as
>>date-s 2015-07-31 #这往往把时间设置为00:00:00fri Jul 00:00:00 PDT 2015
>> date-s 20150730Thu 00:00:00 PDT 2015
>>date-s 2015/07/31FRI Jul 00:00:00 PDT 2015
The above is the setting of several dates, the following is the setting of the time
>>date-s 12:34:22FRI Jul 12:34:22 PDT 2015
--date Show when the condition is met
Such as
>>date Fri Jul 12:39:02 PDT >>date--date= "-1 day" #得到前一天的时间 Thu Jul 12:37:13 PDT 2015
>> Date--date= "-2 month" #得到前两个月的时间 Sun 12:40:37 PDT 2015
>> Date--date= "-1 year" #得到前一年的时间 Thu Jul 12:41:53 PDT 2014
(the upper minus can also be a plus sign, then the time will go forward)
If it appears to be displayed as (Fri 12:44:56 PDT 2015), it is not a person's favorite, you can also use the following way to display the time format you want
Such as
>> Date "+%y-%m-%d%h:%m:%s" 2015-07-31 12:47:12
{
%Y year
%m Month (01-12)
%d days (01-31)
%H hours (00-23)
%M min (00-59)
%s seconds (00-59)
}
The above is only for personal use records, only for parameters!
Linux records----A date using a preliminary record