A date explanation under Linux

Source: Internet
Author: User
Tags local time

Date: View or modify the system date time

Date [OPTION] ... [+format]
Date [-u|--utc|--universal] [MMDDHHMM[[CC]YY][.SS]]


-d,--date= string: The string is entered as a date, not the current time nor the current time setting

Example: [[email protected]/]# date-d 212223
Date:invalid Date ' 212223 '
[Email protected]/]# date-d 2122
Thu 21:22:00 PDT 2015
[Email protected]/]# date-d 21
Thu 21:00:00 PDT 2015
[Email protected]/]# date-d 21222
Date:invalid Date ' 21222 '

[Email protected]/]# date-d 212
Thu 02:12:00 PDT 2015

Summary: A string in-D string can only be 4 digits in number, and can only be changed to hours minutes, hours takes precedence over minutes


-R--reference=file: Lists the last modification time of the following files

Example: [[email protected] tmp]# Date
Thu 07:33:16 PDT 2015
[Email protected] tmp]# date-r
Thu, 2015 07:33:19-0700

-S--set=string: Sets the system time to STRING description

Example: [[email protected] tmp]# Date
Thu 07:36:49 PDT 2015
[Email protected] tmp]# date-s 2237
Thu 22:37:00 PDT 2015
[[Email protected] tmp]# Date
Thu 22:37:03 PDT 2015

-U--utc--universal: View or modify Standard Time


+format:

     %%   a literal%
      %a    Show Current week
      %A    show current week   full name
      %b    Displays the current month, abbreviated
     %b    Displays the current month, full name
       %c    Show Current time
      %C    show current century
      %d    Current date is the day of the current month
     %d     Displays the current date, the display format is  %m/%d/%y (08/20/15)
      %F    Displays the full date; format is%y-% m-%d (2015-08-20)  
     %h    Show Current hour (24-hour)  %k can also achieve this effect
     %i    Displays the current hour (12 hour)   %l can also achieve this effect

%j display date is the first day of the Year in China
%m show it as the first month
%M display the current number of minutes
%r display the current time in 12 hours
%R shows the current hour minute format as%h:%m (22:55)
%s number of seconds since 1970-01-01
%s Displays the current time description
%T Displays the current time, with the time format%h:%m:%s (22:59:57)
%u represents the number of weeks by number; 1 is monday,1-7,7 to Sunday
%w the number of weeks in numbers; 0 is sunday,6 to Saturday
%x displays local time in the time format (12/31/99)
%x displays local time in the format (23:13:48)
%Y Year Displays current years




A date explanation under Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.